LinuxCommandLibrary

pulumi-gen-completion

Generate shell completion scripts for Pulumi

TLDR

Generate completion scripts

$ pulumi gen-completion [bash|zsh|fish]
copy

SYNOPSIS

`pulumi-gen-completion `

PARAMETERS


    Specifies the target shell for which to generate the completion script. Valid values include: `bash`, `zsh`, `fish`, `powershell`.

DESCRIPTION

The `pulumi-gen-completion` command is a utility used internally by the Pulumi CLI to generate shell completion scripts for various shells like Bash, Zsh, Fish, and PowerShell. It is not typically invoked directly by users but is rather used during the Pulumi CLI installation or when setting up shell completion. The generated scripts enable tab completion for Pulumi commands, options, and resource names, making it easier and faster to interact with the Pulumi infrastructure-as-code platform from the command line.

By piping the output of this command into a shell configuration file (e.g., `.bashrc`, `.zshrc`, `config.fish`), users can enable tab completion. This significantly improves the user experience by providing real-time suggestions and reducing the need to remember exact command syntax and resource names.

CAVEATS

This command is primarily intended for internal use by the Pulumi CLI. Direct usage is typically unnecessary as shell completion is usually configured automatically during Pulumi installation.

USAGE EXAMPLE

To generate a Bash completion script and save it to a file:
`pulumi-gen-completion bash > pulumi_completion.bash`
Then, source the file in your `.bashrc` or `.bash_profile`:
`source pulumi_completion.bash`

IMPLEMENTATION DETAILS

The generated completion scripts leverage the shell's built-in completion mechanisms to provide suggestions. Pulumi commands, flags, and resource names are dynamically loaded into the completion script. The process of loading available options for resources names happens when the command is first invoked (or on a regular basis if new resources are created) for interactive suggestions. This ensures that completions are up-to-date with the latest Pulumi features and deployments.

HISTORY

The `pulumi-gen-completion` command was introduced as part of the Pulumi CLI to enhance the user experience by providing shell completion. It evolved alongside the Pulumi CLI, with updates to support new commands, options, and resources. The goal was to make working with Pulumi infrastructure-as-code platform more intuitive and efficient from the command line, and reduce cognitive overhead of knowing the commands.

SEE ALSO

pulumi(1)

Copied to clipboard