Command completion

The CLI provides potential command completions to the command string. Completions are provided by using a question mark (?) or by using the CLI autocompletion feature.

? command completion

The ? command completion is available for any valid command. By typing a command and using a ? as the last argument in the command, the system returns a list of possible command completions from the point of the ?. A short description is provided with each possible completion.

Example

If you enter the following command:
Switch:1(config-isis)#redistribute ?
CLI provides a list of completions for the redistribute ? command.
Switch:1(config-isis)#redistribute ?
	direct     isis redistribute direct command 
	ospf        isis redistribute ospf command 
	rip          isis redistribute rip command 
	static     isis redistribute static command

All the parameters listed under redistribute indicate sub-context commands.

You must use one of the available completions, and if necessary, use the command completion help again to find the next completion.

Switch:1(config-isis)#redistribute direct ?
  enable       Enable isis redistribute direct command
  metric       Isis route redistribute metric
  metric-type  Set isis redistribute metric type
  route-map    Set isis redistribute direct route-policy
  subnets      Set isis redistribute subnets
<cr>

When you see <cr> (Carriage Return/Enter Key) in the list with the additional choices, this means that no additional parameters are required to execute the CLI command. However, the additional choices listed could be peer commands or sub-context commands.

For example, the parameters listed under redistribute direct ? are peer commands. You can enter these peer commands on the same line as the root command, for example redistribute direct enable. However, the <cr> indicates that you can also enter the redistribute direct command only and this command does not require any additional parameters at this level.

CLI autocompletion

CLI autocompletion is a feature that you can use to automatically fill in the unique parts of a command string rather than typing the entire command. Autcompletion makes the CLI experience easier and prevents mistakes in spelling that force you to re-enter the command.

Autocompletion completes the token in the command as soon as it becomes unique.

The Tab key autocompletes the command without executing the command, and places the cursor immediately after the last character. The Enter key autocompletes the command and executes it.

Example

To enable redistribution of ISIS direct routes,

Switch:1(config-isis)#redistribute direct

When you use redistribute ?, you see four possible sub-context commands.

direct
static
ospf    
rip     

If you type the following without pressing Enter:

Switch:1(config-isis)#redistribute direct m

and press the Tab key, the system completes the command to the following point:

redistribute direct metric

Two possible completions exist. You can type -t, and then press Tab to finish the command:

Switch:1(config-isis)#redistribute direct metric-type