The gcloud interactive shell provides a richer
bash experience, simplifying
command and documentation discovery with as-you-type autocompletion and
help text snippets.
It produces suggestions and auto-completion for
kubectl command-line tools, and any command that has a man(1) page.
Sub-commands, flags, and file and resource arguments are completed, along with
inline help, as the command is composed.
Installation and use
Check if you have the
gcloud betacomponents installed:
gcloud components list
To install the beta components:
gcloud components install beta
gcloud beta interactive
Your usual shell prompt will be replaced with the gcloud interactive shell prompt
To exit the interactive shell type
Auto-completion and help
gcloud interactive has auto prompting for commands and flags, and displays
inline help snippets in the lower section as the command is typed.
Static information, like command and sub-command names, and flag names and
enumerated flag values, are auto-completed using dropdown menus. Hit
complete file path and resource arguments.
Type the next character to refine the dropdown completion menu, or use
to scroll through the menu. Finally, use
/ to select the
highlighted item or directory.
To accomplish common tasks, function keys can be used to toggle mode/state settings or run specific actions.
F2:help:STATEToggles the active help section, ON when enabled, OFF when disabled.
F7:contextSets the context for command input, so you won't have to re-type common command prefixes at every prompt. The context is the command line from just after the prompt up to the cursor. For example, if you are about to work with
gcloud computefor a while, type
gcloud computeand hit
F7to clear the context.
F8:web helpOpens a web browser tab/window to display the complete man page help for the current command. Command specific help or man(1) help is attempted, if the web browser is not available.
F9:quitExit. You can also run the
exitcommand or hit
bash completion configs, aliases, exports, functions,
set -o settings,
and variables initialized in your
.bashrc are all available at the
interactive command prompt. The interactive command line edit mode is derived
set -o emacs or
set -o vi setting.
For greater detail about the interactive shell and its shortcuts, control characters, editor modes, and configurable layout options, consult the gcloud beta interactive reference page.