4.6 Using a Pager

You can configure MySQL Shell to use an external pager tool such as less or more. Once a pager is configured, it is used by MySQL Shell to display the text from the online help or the results of SQL operations. Use the following configuration possibilities:

  • Configure the shell.options[pager] = "" MySQL Shell option, a string which specifies the external command that displays the paged output. This string can optionally contain command line arguments which are passed to the external pager command. Correctness of the new value is not checked. An empty string disables the pager.

    Default value: empty string.

  • Configure the PAGER environment variable, which overrides the default value of shell.options["pager"] option. If shell.options["pager"] was persisted, it takes precedence over the PAGER environment variable.

    The PAGER environment variable is commonly used on Unix systems in the same context as expected by MySQL Shell, conflicts are not possible.

  • Configure the --pager MySQL Shell option, which overrides the initial value of shell.options["pager"] option even if it was persisted and PAGER environment variable is configured.

  • Use the \pager | \P command MySQL Shell command to set the value of shell.options["pager"] option. If called with no arguments, restores the initial value of shell.options["pager"] option (the one MySQL Shell had at startup. Strings can be marked with " characters or not. For example, to configure the pager:

    • pass in no command or an empty string to restore the initial pager

    • pass in more to configure MySQL Shell to use the more command as the pager

    • pass in more -10 to configure MySQL Shell to use the more command as the pager with the option -10

The MySQL Shell output that is passed to the external pager tool is forwarded with no filtering. If MySQL Shell is using a prompt with color (see Section 13.3, “Customizing the Prompt”), the output contains ANSI escape sequences. Some pagers might not interpret these escape sequences by default, such as less, for which interpretation can be enabled using the -R option. more does interpret ANSI escape sequences by default.