A mount run= that reads another usage script's spec no longer fails when an environment variable holds a value that script rejects, and the Cobra exporter now writes specs that usage lint accepts.
Fixed
-
(lib) A
mount run=that gets its spec from another usage-shebang script now works even when the environment holds a value that one of that script's env-bound flags rejects (#1591, @jdx). For example, if the child declaresflag "--mode <m>" env="X_MODE" { choices "a" "b" }, thenX_MODE=zzz ./parent subused to fail withInvalid choice for option mode: zzz(exit 181), and completion failed the same way. When usage runs the script itself and the parse fails, it now drops the env values the spec rejects and keeps the valid ones. If the parse still fails, the original error is reported. Running the script directly still reports invalid env values, and a bad value typed on the command line is still an error.When a mount does fail, the error now names the command being resolved:
could not read the commands mounted under `sub`: exited with code 1 sh -c ./child2This message comes from
usage-lib, so CLIs built on it show the same wording. Script exit codes have not changed, and they are now documented indocs/cli/scripts.md: the script's own code when it runs,1when the command line doesn't satisfy the spec, and181when usage can't read or run something the spec depends on, such as an invalid spec or a failing mount. -
(cli) The Cobra integration now quotes flag defaults that KDL would otherwise read as non-strings (#1595, @jdx). Before this fix, a
Boolflag defaulting totrueor anIntflag defaulting to-1produceddefault=trueordefault=-1, andusage lintrejected the spec. Defaults such astrue,false,null,inf,-inf,nan, signed numbers (-1,+1,-0.5) and values containing[or]are now written as quoted strings. Plain values such asjsonare still written without quotes.
Full Changelog: v7.1.3...v7.1.4
💚 Sponsor usage
usage is built and maintained by @jdx, an open source developer at entire.io, the title sponsor of his open source work.
If usage powers CLI specs, docs, or completions for a tool you maintain or use, please consider becoming an individual or company sponsor. Your support funds ongoing development and helps keep usage fast, free, and independent.