5.8.2.4 Command Line Help

You can access the MySQL Shell online help when calling commands from the command-line integration using the --help (-h) CLI argument. Help is supported at the global, object and command level.

Note

The built-in help CLI argument does not map to any API argument and is supported in all the objects and commands available in CLI.

The descriptions of the commands and parameters is taken from the existing documentation for the target API function.

Global CLI Help

To retrieve the list of global objects available for CLI calls, use the following syntax:

$ mysqlsh -- --help

In this example, -- initiates the command-line integration section of the command. Using the --help or -h option alone after that lists the global objects available within this interface.

Object Help

To access the object help from the command-line integration, use the following syntax:

$ mysqlsh -- object --help

where object is what you want help on, such as the dba global object. This call displays:

  • A brief description of the object.

  • A list of the available commands and a short description of them.

To retrieve the help for nested objects, provide the entire list of objects before the --help argument. For example, to get help on the shell.options functions, issue:

$ mysqlsh -- shell options --help
Command Help

To display help on commands from the command-line integration, use the following syntax:

$ mysqlsh -- object command --help

This call displays details about the command, including:

  • A brief description of what the command does.

  • The signature for calling the command.

  • The list of anonymous arguments and a brief description of each.

  • The list of named arguments, their expected data types, and a brief description explaining the purpose of each argument.

For the case of commands in nested objects, the entire list of objects should be provided before the command, for example:

$ mysqlsh shell options set-persist --help

For parameters that expect a specific data type, the argument is listed as:

--name=type
Brief description of the parameter.

The type information represents the expected data type for the argument, for example: str, int, uint, bool, list, float, or dict.

For example, the consistent key of the dump-schemas parameter:

$ mysqlsh -- util dump-schemas --help
...
--consistent=<bool>
Enable or disable consistent data dumps. Default: true.
...

For parameters that support different data types, the argument is listed as:

--name[:type]=value
Brief description of the parameter.

For example, the columns key of the util.importTable() operation.

$ mysqlsh -- util import-table --help
...
--columns[:<type>]=<value>
Array of strings and/or integers (default: empty array) - This...
...