summaryrefslogtreecommitdiff
path: root/lib/cli.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib/cli: mkKey -> mkOptionName, use generators.mkValueStringDefault•••Let’s call them by what they are, option names. `generators.mkValueStringDefault` is a better value string renderer than plain `toString`. Also add docs to all options. Profpatsch2020-01-231-11/+25
* lib/cli: rename `renderX` options to `mkX`•••Mirrors the naming scheme in `generators.nix`, for consistency. Also rename `key` to `k` and value to `v` to aid readability to the code structure. Profpatsch2020-01-231-17/+14
* lib/cli,lib/tests/misc: somewhat more standard formattingProfpatsch2020-01-231-41/+35
* lib/cli: encodeGNUCommandLine -> toGNUCommandLineShell•••The semantic difference between `encode` and `to` is not apparent. Users are likely to confuse both functions (which leads to unexpected error messages about the wrong types). Like in `generators.nix`, all functions should be prefixed by `to`. Furthermore, converting to a string depends on the target context. In this case, it’s a POSIX shell, so we should name it that (compare `escapeShellArg` in `strings.nix`). We can later add versions that escape for embedding in e.g. python scripts or similar. Profpatsch2020-01-231-2/+24
* Factor out a `toGNUCommandLine` utility•••... as suggested by @roberth Gabriel Gonzalez2020-01-051-7/+11
* Use a more realistic example that exercises all encodings•••... as suggested by @roberth This also caught a bug in rendering lists, which this change also fixes Gabriel Gonzalez2019-12-151-3/+18
* Make behavior of `encodeGNUCommandLine` customizable•••... based on feedback from @edolstra Gabriel Gonzalez2019-12-131-13/+17
* Rename `renderOptions` to `encodeGNUCommandLine`•••... as suggested by @edolstra Gabriel Gonzalez2019-12-131-2/+2
* Add `pkgs.lib.renderOptions`•••This adds a new utility to intelligently convert Nix records to command line options to reduce boilerplate for simple use cases and to also reduce the likelihood of malformed command lines Gabriel Gonzalez2019-12-111-0/+33