4.6 Using a Pager

You can configure MySQL Shell to use an external pager tool such aslessormore. 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 theshell.options[pager] = ""MySQL Shell option, a string which specifies the external command that displays the paged output. This string can 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.

    默认值:空字符串.

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

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

  • Configure the--pagerMySQL Shell option, which overrides the initial value ofshell.options["pager"]option even if it was persisted andPAGERenvironment variable is configured.

  • Use the\pager | \PcommandMySQL Shell command to set the value ofshell.options["pager"] option. If called with no arguments, restores the initial value ofshell.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 nocommandor an empty string to restore the initial pager

    • pass inmoreto configure MySQL Shell to use themorecommand as the pager

    • pass inmore -10to configure MySQL Shell to use themorecommand 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 (seeSection 13.3, “Customizing the Prompt”), the output contains ANSI escape sequences. Some pagers might not interpret these escape sequences by default, such asless, for which interpretation can be enabled using the-Roption.moredoes interpret ANSI escape sequences by default.