Skip to content
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

Add option value completion #23

Open
hedning opened this issue Apr 30, 2019 · 0 comments
Open

Add option value completion #23

hedning opened this issue Apr 30, 2019 · 0 comments

Comments

@hedning
Copy link
Collaborator

hedning commented Apr 30, 2019

There's one pretty straightforward thing to do here: provide reasonable completion for things like builders and stores.

Unfortunately nix --help-config dosen't report the type of an option. That means we'll have to build a manual lookup table for known options (with sane fallback).

We also want to at least recognize the short form of options (nix build --no-sandbox etc.). Thankfully we can infer boolean types from descriptions starting with Whether . Meaning we're able to determine if a short option takes an argument or not automatically. That way we won't mistake an option argument as a normal argument (eg. nix-build --foo bar -A baz).

I feel that completing all the options by default is a bad idea, as there's a ton of them which makes it hard to pick out the important stuff. We do something similar with nix-store completing everything only after we've started to type --*: https://github.com/spwhitt/nix-zsh-completions/blob/master/_nix-store#L134. Though I'm not sure if it's easy to make a general solution for this, and since we're dealing with optargs we'll have to provide the necessary information to _arguments when necessary.

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

No branches or pull requests

1 participant