The MD-CLI supports both command abbreviation and command completion. When typing a command, Tab, Spacebar, or ⏎ invokes auto-completion. If the text entered is enough to match a specific command, auto-completion completes the command. If the text entered is not sufficient to identify a specific command, pressing Tab or Spacebar displays options in alphabetical order matching the text entered.
The environment command-completion command controls what keystrokes can trigger command completion. Each keystroke is independently controlled with its own Boolean value.
(ex)[/environment command-completion]
A:admin@node-2# info detail
enter true
space true
tab true
configure por+Spacebar displays auto-completion results
configure port+Spacebar inserts a space and suppresses auto-completion results
configure por+Tab displays auto-completion results
configure port+Tab displays auto-completion results
Variable parameter completion works only with the Tab key. All configured variables from the candidate and running configuration datastores are displayed. Line wrapping may occur for variables with long names. Parameters are displayed in alphabetical or numerical order. The variable parameter name is always displayed as the first line.
In the following example, "interface-name" is the variable parameter name and "int-1" and "system" are configured names.
*[ex:/configure router "Base"]
A:admin@node-2# interface Press Tab
<interface-name>
"int-1"
"system"
*[ex:/configure router "Base"]
A:admin@node-2# interface
Some list elements have a default keyword defined, such as the router command, where the default keyword is "Base". When the command completion parameters (⏎, Spacebar, and Tab) are at their default settings (true), and the initial input matches an element in the list and a unique command keyword, the matching keyword is completed instead of the variable.
For example, the router command has a default keyword defined as "Base". If router "bf" is created using the command configure router "bf" (with quotation marks), and there is an existing bfd command context, the variable completion is as follows.
*[ex:/configure]
A:admin@node-2# router Press Tab
<router-name>
"Base"
"bf"
"management"
aggregates allow-icmp-redirect allow-icmp6-redirect
apply-groups apply-groups-exclude autonomous-system
bfd bgp bier
---snip---
*[ex:/configure]
A:admin@node-2# router bfPress Tab
"bf"
bfd
Entering router bf+ ⏎ completes to router bfd and enters the router "Base" bfd context:
*[ex:/configure]
A:admin@node-2# router bfd Press Enter
*[ex:/configure router "Base" bfd]
A:admin@node-2#
Similarly, router bf+Spacebar completes to router bfd and enters the router "Base" bfd context when ⏎ is pressed:
*[ex:/configure]
A:admin@node-2# router bfd Press Space Press Enter
*[ex:/configure router "Base" bfd]
A:admin@node-2#
To enter the context for router "bf", use quotation marks to specify the variable:
[ex:/configure]
A:admin@node-2# router "bf"
*[ex:/configure router "bf"]
A:admin@node-2#
If the command completion for enter is set to false, router bf+ ⏎ allows the match to router "bf". Similarly, when the command completion for space is false, router bf+Spacebar also matches to router "bf" instead of the bfd context
*(ex)[/environment command-completion]
A:admin@node-2# info detail
enter true
space true
tab true
*(ex)[/environment command-completion]
A:admin@node-2# enter false
*(ex)[/environment command-completion]
A:admin@node-2# space false
*(ex)[/environment command-completion]
A:admin@node-2#
*(ex)[/]
A:admin@node-2# configure
*(ex)[/configure]
A:admin@node-2# router bf Press Enter
*(ex)[/configure router "bf"]
A:admin@node-2# back
*(ex)[/configure]
A:admin@node-2# router bf Press Space Press Enter
*(ex)[/configure router "bf"]
A:admin@node-2#
For keyword-based leaf-lists, command completion displays all possible values, not only those that are configured. When deleting values in a leaf-list, only the values that are currently configured are displayed.
In the following example, when defining the forwarding traffic classes, all keyword values are listed. When deleting the forwarding traffic classes, only the configured classes are displayed.
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# family ?
family <value>
family [<value>...] - 1..20 system-ordered values separated by spaces
enclosed by brackets
<value> - <keyword>
<keyword> - (ipv4|vpn-ipv4|ipv6|mcast-ipv4|vpn-ipv6|l2-vpn|mvpn-ipv4|mdt-
safi|ms-pw|flow-ipv4|route-target|mcast-vpn-ipv4|mvpn-ipv6|
flow-ipv6|evpn|mcast-ipv6|label-ipv4|label-ipv6|bgp-ls|mcast-
vpn-ipv6|sr-policy-ipv4|sr-policy-ipv6)
Address family as the match condition
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# family [ipv4 mcast-ipv4 mcast-vpn-ipv4 label-ipv4]
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# info
family [ipv4 mcast-ipv4 mcast-vpn-ipv4 label-ipv4]
*[ex:/configure policy-options policy-statement "ss" entry 3 from]
A:admin@node-2# delete family Press Tab
<family>
ipv4
mcast-ipv4
mcast-vpn-ipv4
label-ipv4
*
The explicit use of the keyword true for a Boolean element is optional. If neither true or false is entered, the keyword true is assumed.
(ex)[/environment]
A:admin@node-2# more ?
more <boolean>
<boolean> - ([true]|false)
Default - true
Prompt to continue or stop when output text fills page
When Tab is used for command completion with Boolean elements, the values of false and true are displayed, along with the names of possible elements that can follow.
In the following example of the environment more command, the commands command-completion, console, message-severity-level, and so on, can be defined following the more command.
(ex)[/environment]
A:admin@node-2# more Press Tab
<more>
false
true
command-completion console message-severity-level
progress-indicator prompt time-display
time-format
delete