Skip to content

Commit

Permalink
lib/cli: add comment clarifying behavior
Browse files Browse the repository at this point in the history
It wasn't clear to me why `toGNUCommandLine` would take an input like
this `foo = "bar"`, and turn it into `[ "foo" "bar" ]`. I implemented
a change to this, only to realize that this behavior is actually for
`toGNUCommandLineShell`. It uses `lib.escapeShellArgs`, which treats
the input `[ "--foo" "bar" ]` and `[ "--foo bar" ]` differently. The
comment will hopefully prevent others from going down the same rabbit
hole that I did.
  • Loading branch information
llakala committed Jan 13, 2025
1 parent 3e03bcb commit 032647e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/cli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ rec {
in
if v == null then
[ ]
# We need the option and its value in different list elements, to play nice with `lib.escapeShellArgs`
else if optionValueSeparator == null then
[
(mkOptionName k)
Expand Down

0 comments on commit 032647e

Please sign in to comment.