Updated on 2023-02-27 GMT+08:00

Using Interactive Prompts

KooCLI provides powerful interactive prompts to facilitate command building on different platforms. Add --interactive in a command to enter the interactive mode. In this mode, the system displays cloud service names, API operations, parameters, and descriptions based on the information you enter. In addition, the system autocompletes the values of some parameters.

  • Use the interactive mode as follows:
    • Use the Tab key or the up and down arrows to select the content to be autocompleted.
    • Press the space bar to add the selected content to the current command.
    • After entering the interactive mode, press Ctrl+C to switch to a new command line. To exit the interactive mode, press Ctrl+D.
  • The following contents will be prompted and autocompleted in the interactive mode:
    • Cloud services

      When you enter the interactive mode for the first time, the list of cloud services and system commands is automatically displayed.

      Figure 1 List of cloud services and system commands

      In the cloud service list, the left column displays cloud service abbreviations or system commands, and the right column displays the full service names or system command descriptions.

    • APIs

      After you enter a valid cloud service name or system command, the API list of the service or the subcommands (or parameters) of the system command are displayed.

      In the system command list, the left column displays the subcommands (or parameters) of the system command, and the right column displays the descriptions of the subcommands (or parameters).

      Figure 2 Cloud service API list

      In the cloud service API list, the left column displays API operation names, and the right column displays API descriptions.

      Figure 3 Subcommands of a system command
      Figure 4 System command parameters

      If the entered cloud service name or system command is invalid, no prompt is displayed.

    • Parameters

      After you enter a valid cloud service name and API operation, or a valid system command and subcommand, the parameter list of the API or subcommand is displayed.

      Figure 5 Cloud service API parameter list
      Figure 6 Subcommand parameter list of a system command

      In the parameter list, the left column displays parameter names, and the right column displays their descriptions.

      If the entered API operation or subcommand is invalid, or the entered parameter name is invalid, no prompt is displayed.

    • Values

      In interactive mode, if you enter an equal sign (=) after a parameter name, the allowed values or the default value of the parameter is displayed. This value prompt is available only for certain parameters. For example, if you enter --cli-region= in an API calling command, the regions where the API is available are displayed.

      Figure 7 Regions where an API is available
  • Shortcut keys in interactive mode
    • Ctrl+W: Delete the word before the cursor.
    • Ctrl+K: Delete the content after the cursor.
    • Ctrl+U: Delete the content before the cursor.
    • Ctrl+L: Clear the screen.
  • If no profile is added, or the region specified in the default profile is not supported by the API in the command, select a region from the cli-region list prompted for the API. Then, KooCLI continues to display the parameter list of the API.
  • In interactive prompts, parameters except custom map type parameters (containing {*} in their names) will not be prompted again once entered. If a parameter name contains [N], which indicates an index, replace the character with a number. If a parameter name contains {*}, which indicates a custom parameter name, replace the character with a string that does not contain periods (.).
  • After switching to a new command line, you can use the up and down arrows to browse the records of executed commands.