Skip to content

Embed shell completion scripts in binary, provide completion subcommand #162

@dontlaugh

Description

@dontlaugh

This would be a nice feature, imo. I like it when binary tools provide a subcommand to print shell completion functions to stdout.

For example, see this help text from kubectl completion -h

  # Load the kubectl completion code for zsh[1] into the current shell
  source <(kubectl completion zsh)
  # Set the kubectl completion code for zsh[1] to autoload on startup
  kubectl completion zsh > "${fpath[1]}/_kubectl"

Packagers who want to deal with script files could still have access to them.

This is easiest when you use Go 1.16 or higher. Prior to Go 1.16, you need an extra build config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions