Command Information
Define this command for me!
Each command you define in your shell must provide a new instance of the CommandInfo
class holding details about the specified command. The new instance of the class can be made using the constructor defined below:
where:
Command
: The commandHelpDefinition
: The brief summary of what the command doesCommandArgumentInfo
: Array of argument information about your commandCommandBase
: An instance of theBaseCommand
containing command execution information
To implement CommandArgumentInfo
, call the constructor either with no parameters, which implies that there is no argument required to run this command, or with the following options listed below.
where:
Arguments
: Defines the command argumentsSwitches
: Defines the command switchesAcceptsSet
: Whether to accept the-set
switchinfiniteBounds
: Whether to accept infinite number of arguments or not
For CommandArgumentPart
instances, consult the below constructor to create an array of CommandArgumentPart
instances when defining your commands:
where:
argumentRequired
: Is this argument part required?argumentExpression
: Command argument expressionautoCompleter
: Auto completion function delegateThe first
string[]
denotes the list of last passed argumentsThe second
string[]
(output) denotes the suggestions returned
isNumeric
: Whether this argument part accepts numeric values onlyexactWording
: If not empty, the user must write one of the words declared in this variable for this argument to be satisfiedargumentDesc
: Argument description that shows up in the help entry
When it comes to auto-completion, if you press TAB
on any of the argument positions, the shell will select the following completers as appropriate:
If the auto completer is specified, then, regardless of whether the expression represents the selection (expressions containing the slash
/
character) or not, the auto completer specified in the constructor will be called.If the auto completer is not specified, then it will go through the following completers:
The shell goes through the list of known completion expressions according to the argument expression, which are the following:
cmd
,command
: List of all available commandsshell
: List of all available shells
If the expression is not listed in any of the known expressions list, it'll check for the selection indicator characters (the slash
/
key).For example, the
true/false
expression will generate an autocompleter that completes the two words:true
andfalse
.
In case there is none, the shell will use the default auto completer, which returns nothing.
Usually, there is no need for you to cut the string to the required position; the shell does it to every single autocomplete result that is given.
Command argument part with options
In case you want to expressively specify the options without having to use default values for all parameters to set a certain parameter, you can use the CommandArgumentPartOptions
overload:
Last updated