mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
cli.nix: permit separators between args -> -a=b
, --xyz=abc
, etc
This commit is contained in:
parent
4ed7156191
commit
9c9c3848d4
2 changed files with 31 additions and 1 deletions
11
lib/cli.nix
11
lib/cli.nix
|
@ -90,7 +90,16 @@ rec {
|
|||
mkOption ?
|
||||
k: v: if v == null
|
||||
then []
|
||||
else [ (mkOptionName k) (lib.generators.mkValueStringDefault {} v) ]
|
||||
else if optionValueSeparator == null then
|
||||
[ (mkOptionName k) (lib.generators.mkValueStringDefault {} v) ]
|
||||
else
|
||||
[ "${mkOptionName k}${optionValueSeparator}${lib.generators.mkValueStringDefault {} v}" ],
|
||||
|
||||
# how to separate an option from its flag;
|
||||
# by default, there is no separator, so option `-c` and value `5`
|
||||
# would become ["-c" "5"].
|
||||
# This is useful if the command requires equals, for example, `-c=5`.
|
||||
optionValueSeparator ? null
|
||||
}:
|
||||
options:
|
||||
let
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue