The CLI is a key configuration tool. After you log in to a router, a prompt is displayed, indicating that you have accessed the CLI and can enter a command.
The CLI parses commands and packets carrying configuration information. You can use the CLI to configure and manage routers. The CLI also provides an online help function.
To parse a command, the CLI undergoes the following phases:
Command receiving phase
The CLI receives and displays all characters you have entered. When you press Enter, the CLI begins to process the command.
Command matching phase
The system compares the received command with commands in the current command mode to search for a matching command.
If a matching command exists, the system enters the command checking phase.
If a matching command does not exist, the system informs you that the command is invalid and waits for a new command.
Command checking phase
The CLI checks every element of the entered command against the matching command, including the string length and value range validity.
If all command elements are valid, the system authenticates the command.
If any command element is invalid, the system informs you that the command is invalid and waits for a new command.
Command authentication phase
The system authenticates the user name and command locally or sends them to the AAA server for authentication.
If you have permission to run the command, the system begins to parse the command.
If you do not have permission to run the command, the system displays a message and waits for a new command.
Command parsing phase
After parsing a command into a packet that carries specific information, the CLI sends the packet to the command processing module and waits for the results. The CLI then parses the packet carrying the results and displays them on the terminal.
Online help is one of the basic components of the CLI. This function helps you know which commands can be configured and provides the predictive text input function. For example, when entering a command, the value range of a parameter in the command is provided. Online help can be classified as full, partial, or Tab help.
Full help
In any command view, when you enter a question mark (?) at the command prompt, all the first element of the commands available in the command view and their brief descriptions are listed.
When you enter a command followed by a space and a question mark (?), all the keywords and their brief descriptions are listed if the position of the question mark (?) is for a keyword.
When you enter a command followed by a space and a question mark (?), the value range and function of the parameter are listed if the position of the question mark (?) is for a parameter.
To provide full help in command mode, the CLI undergoes the following phases:
Command receiving phase
The CLI receives and displays all characters you have entered. When you enter a question mark (?), the CLI starts online help. If full help is required, the system starts full help.
Command matching phase
The system compares the received command with commands in the current command mode to search for a matching command.
If a matching command exists, the system matches commands with your permission and displays all commands you can use.
If a matching command does not exist, the system informs you that the command is invalid and waits for a new command.
Command help phase
The system searches the configurable commands for possible elements in the question mark (?) position.
If the entered command is complete, cr is displayed.
If the entered command is incomplete, possible command elements and their description are displayed.
Partial help
When you enter a string followed by a question mark (?), the system lists all keywords that start with the string.
If the position of the question mark (?) is for a keyword, all keywords in the command starting with the string are listed.
If the position of the question mark (?) is for a parameter and the parameter is valid, information about all the parameters starting with the string is listed, including the value range.
If the position of the question mark (?) is for a parameter but the parameter is invalid, the CLI informs you that the input is incorrect.
To provide partial help in specific command mode, the CLI undergoes the following phases:
Command receiving phase
The CLI receives and displays all characters you have entered. When you enter a question mark (?), the CLI starts online help. If partial help is required, the system starts partial help.
Command matching phase
The system compares the received command with commands in the current command mode to search for a matching command.
If a matching command exists, the system matches commands with your permission and displays all commands you can use.
If a matching command does not exist, the system informs you that the command is invalid and waits for a new command.
Command help phase
The system searches configurable commands for possible command elements in the position of a question mark (?) and displays possible command elements.
Tab help
Tab help is an application of partial help, which provides help only for keywords. The system does not display the description of a keyword.
You can enter the first letters of a keyword in a command and press Tab.
Tab help information is displayed in lexicographical order.
If what you have entered identifies a unique keyword, the complete keyword is displayed.
If what you have entered does not identify a unique keyword, you can press Tab repeatedly to view the matching keywords and select the desired one.
If what you have entered does not match any command element, the system does not modify the input and just displays what you have entered.
If what you have entered is not a keyword in the command, the system does not modify the input and just displays what you have entered.
The CLI also provides dynamic help for querying the database and script. If parameters in a command support dynamic help and you enter the first letters of a parameter in the command and press Tab, the following situations occur:
If what you have entered identifies a unique parameter, the complete parameter is displayed.
If what you have entered does not identify a unique parameter, you can press Tab repeatedly to view the matching parameters and select the desired one.
Shortcut keys are classified as system or user-defined shortcut keys.
User-defined shortcut key: You can associate a shortcut key with any command. When the shortcut key is used, the system automatically executes the corresponding command.
System shortcut key: System shortcut keys are fixed in the system. They represent fixed functions and cannot be defined by users.
Different terminal software defines shortcut keys differently. Therefore, the shortcut keys on your terminal may be different from those listed here.
Before you run a command, the system authenticates your permission. When the CLI starts, it obtains an authentication policy from the local AAA server and authenticates all commands based on this policy.