Skip to content

Make sure -W argument to compgen is escaped #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ncfavier
Copy link

Fixes NixOS/nixpkgs#284162

Shell quoting is honored in the argument to compgen -W, which we approximate by not removing the double quotes from the Nix output.

A more robust solution would be to use nix-instantiate --json and parse the output with jq -r '@sh', but that requires adding an external dependency.

Shell quoting is honored in the argument to `-W`, which we approximate
by not removing the double quotes from the Nix output.

A more robust solution would be to use `nix-instantiate --json` and
parse the output with `jq -r '@sh'`, but that requires adding an external dependency.
Comment on lines -1289 to +1292
COMPREPLY=($(compgen -W "${systems[*]//@(\[|\])/}" -- "$cur"))
COMPREPLY=($(compgen -W "${systems[*]}" -- "$cur"))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_nix_eval_stdin already removes brackets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

customization function makeScopeWithSplicing' messes up bash-completion for nix-shell -p
1 participant