-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CommandType
in more places
#12832
Conversation
I don't really want to lose the granularity that we have in scope commands now. I haven't looked close enough at this PR to determine if that is happening. Do we have all these categories still, just represented in the type column? │ 5 │ is_builtin │ I'd like to be able to keep this level of detail if we can. Here's part of why I'm thinking this. I've been brainstorming a new command that is really about learning nushell. Maybe a So, I see a logical breakdown like these is_* bools as helpful for somehow participating in a periodic table of commands. |
The My understanding is that all the command types are, or should be, mutually exclusive. So, collapsing them all into a single column doesn't lose any granularity. E.g., instead of |
Just looking at the list and not the code, it seems that is_builtin, is_sub, is_keyword could be one command, maybe? i'm not sure what is_extern refers to. I'm not real familiar with how nushell assigns any of these really. |
The current list of command types are:
At least, that is to my understanding, and so there doesn't seem to be much overlap. |
I think this cleanup makes sense to me. There isn't a reason for those |
@@ -18,7 +18,7 @@ impl NuHelpCompleter { | |||
//Vec<(Signature, Vec<Example>, bool, bool)> { | |||
let mut commands = full_commands | |||
.iter() | |||
.filter(|(sig, _, _, _, _)| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screaming at the comment above that was already out of date trying to explain the type.
Tuples considered harmful
Ok, let's give this a go. |
Description
Kind of a vague title, but this PR does two main things:
Command::is_parser_keyword
, this PR instead changes commands to overrideCommand::command_type
. TheCommandType
returned byCommand::command_type
is then used to automatically determine whetherCommand::is_parser_keyword
and the otheris_{type}
functions should return true. These changes allow us to remove theCommandType::Other
case and should also guarantee than only one of theis_{type}
functions onCommand
will return true.Command::command_type
function in thescope commands
andwhich
commands.User-Facing Changes
scope commands
: multiple columns (is_builtin
,is_keyword
,is_plugin
, etc.) have been merged into thetype
column.which
command can now reportplugin
orkeyword
instead ofbuilt-in
in thetype
column. It may also now reportexternal
instead ofcustom
in thetype
column for knownextern
s.