Skip to content

could vault have a mode where it just outputs the shell completion code ? #22784

@teto

Description

@teto

Is your feature request related to a problem? Please describe.

Most programs output the completion scripts and the user can load them. vault -autocomplete-install (added in https://github.com/hashicorp/vault/pull/3223/files) tries to do the install but this fails in my instance since my .bashrc is read-only (for security reasons, and I can't ):

 vault -autocomplete-install
Error executing CLI: 1 error occurred:
	* open /home/teto/.bashrc: permission denied

Describe the solution you'd like
I would like vault to just output the autocompletion code and let the user install the completion, it works better for package managers too such as apt or nix where you can add the autocompletion next to the software

Describe alternatives you've considered
I've tried export HOME=/tmp to run the command but vault still attempted to write to /home/teto/.bashrc which seems to be another error ?

Explain any additional use-cases
My main shell is zsh so it would be nice to have zsh completion too though it seems like this can be done through a zsh compatibility layer #9901 (comment)

Additional context
If the change is done here, I will update the nix package https://github.com/NixOS/nixpkgs/blob/d9811d585a4e967c3883f11b7653b44121c25f62/pkgs/tools/security/vault/default.nix#L35

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions