aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.cc
AgeCommit message (Collapse)Author
2024-03-04Merge pull request #8931 from fricklerhandwerk/nix3-config-optionsThéophane Hufschmitt
do not show configuration override flags for each command (cherry picked from commit f89b84919c1a5c796512c50311821e7779b3678b) Change-Id: Ib98b739bd6c9a1e94f94a78a47d84d72e435e7c0
2023-08-11MultiCommand::toJSON: Fix use-after-moveYorick van Pelt
2023-06-18Create nlohmann serializers for `std::optional` and useJohn Ericson
This is somewhat tricky.
2023-04-03Stuctured command stabilityJohn Ericson
Prior to this, there was an ad-hoc whitelist in `main.cc`. Now, every command states its stability. In a future PR, we will adjust the manual to take advantage of this new information in the JSON. (It will be easier to do that once we have some experimental feature docs to link too; see #5930 and #7798.)
2023-03-20Fix handling of experimental features mid-parseJohn Ericson
If we conditionally "declare" the argument, as we did before, based upon weather the feature is enabled, commands like nix --experimental-features=foo ... --thing-gated-on-foo won't work, because the experimental feature isn't enabled until *after* we start parsing. Instead, allow arguments to also be associated with experimental features (just as we did for builtins and settings), and then the command line parser will filter out the experimental ones. Since the effects of arguments (handler functions) are performed right away, we get the required behavior: earlier arguments can enable later arguments enabled! There is just one catch: we want to keep non-positional flags...non-positional. So if nix --experimental-features=foo ... --thing-gated-on-foo works, then nix --thing-gated-on-foo --experimental-features=foo ... should also work. This is not my favorite long-term solution, but for now this is implemented by delaying the requirement of needed experimental features until *after* all the arguments have been parsed.
2023-02-10Completions::add use libutil trim()Philipp Jungkamp
2023-02-10Infer short completion descriptions for commandline flagsPhilipp Jungkamp
Descriptions for commandline flags may not include newlines and should be rather short for display in a shell. Truncate the description string of a flag on '\n' or '.' to and add an ellipsis if needed.
2022-10-22Fix C++20 warningsGraham Bennett
2022-09-13Trim option descriptionsEelco Dolstra
This removes unintended blank lines in Markdown when the description is a multiline string literal.
2022-07-11Fix flake input completion for `InstallablesCommand`sNaïm Favier
Defers completion of flake inputs until the whole command line is parsed so that we know what flakes we need to complete the inputs of. Previously, `nix build flake --update-input <Tab>` always behaved like `nix build . --update-input <Tab>`.
2022-04-19Merge pull request #6128 from ncfavier/fix-completionEelco Dolstra
Shell completion improvements
2022-03-07Perform tilde expansion when completing flake fragmentsNaïm Favier
Allows completing `nix build ~/flake#<Tab>`. We can implement expansion for `~user` later if needed. Not using wordexp(3) since that expands way too much.
2022-03-07Make completeDir follow symlinksNaïm Favier
Allows completing `nix why-depends /run/cur<Tab>` to /run/current-system
2022-03-07Ensure the completion marker is not processed beyond completionNaïm Favier
I was surprised to see an error mentioning ___COMPLETE___ when trying to complete a flag argument that had no completer implemented
2022-03-07Implement a suggestions mechanismregnat
Each `Error` class now includes a set of suggestions, and these are printed by the top-level handler.
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2021-12-22Don't insert spaces when completing attribute pathsNaïm Favier
2021-09-13nix --help: Display help using lowdown instead of manEelco Dolstra
Fixes #4476. Fixes #5231.
2021-02-26nix flake update: Recreate the lock fileEelco Dolstra
This is probably what most people expect it to do. Fixes #3781. There is a new command 'nix flake lock' that has the old behaviour of 'nix flake update', i.e. it just adds missing lock file entries unless overriden using --update-input.
2021-02-24Respect command registrations in plugins.Shea Levy
2021-02-24Initialize plugins after handling initial command line flagsShea Levy
This is technically a breaking change, since attempting to set plugin files after the first non-flag argument will now throw an error. This is acceptable given the relative lack of stability in a plugin interface and the need to tie the knot somewhere once plugins can actually define new subcommands.
2021-02-07Support --no-net for backwards compatibilityEelco Dolstra
2021-01-25Group common optionsEelco Dolstra
2021-01-25Group subcommands by categoryEelco Dolstra
2021-01-25Make '--help' do the same as 'help' (i.e. show a manpage)Eelco Dolstra
2020-12-23Command: Remove examples()Eelco Dolstra
2020-12-21Move doc() to ArgsEelco Dolstra
2020-12-03Add deprecated aliases for renamed commandsEelco Dolstra
2020-10-09Completions::add(): Guard against newlinesEelco Dolstra
2020-10-09Add a description in the completion outputsregnat
Make nix output completions in the form `completion\tdescription`. This can't be used by bash (afaik), but other shells like zsh or fish can display it along the completion choices
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-08-20Allow 'nix' subcommands to provide docs in Markdown formatEelco Dolstra
2020-08-17Start generation of the nix.1 manpageEelco Dolstra
2020-08-17Add 'nix dump-args' to dump all commands/flags for manpage generationEelco Dolstra
2020-07-01Don't process an option if any of its arguments need completionEelco Dolstra
2020-06-26Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-18Merge branch 'enum-class' into no-hash-type-unknownJohn Ericson
2020-06-18Merge remote-tracking branch 'upstream/master' into enum-classJohn Ericson
2020-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-11Merge remote-tracking branch 'upstream/master' into errors-phase-2Ben Burdette
2020-06-04Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-04Make 'nix dev-shell' a deprecated alias for 'nix develop'Eelco Dolstra
2020-06-02Fix to-base --type handler to correctly set std::optional flagJohn Ericson
Now that we have a separate flag function, also describe why it is optional.
2020-06-02Remove `HashType::Unknown`John Ericson
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may also make `Hash` itself require a known hash type, encoraging people to use `std::optional<Hash>` instead.
2020-05-28Merge branch 'master' of github.com:NixOS/nix into enum-classCarlo Nucera
2020-05-12Fix macOS buildEelco Dolstra
macOS doesn't have GLOB_ONLYDIR.
2020-05-11fixes to merged codeBen Burdette
2020-05-11Merge branch 'master' into errors-phase-2Ben Burdette
2020-05-11When completing flakerefs, only return directoriesEelco Dolstra
2020-05-11Shut up warnings while running completersEelco Dolstra