allod change record: --files is documented variadic but takes one value #130
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#130
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
allod change record's usage text documents--filesas variadic —[--files <file>...]— but the option parser consumes exactly one value per occurrence. Passing two paths after one flag aborts the command:The second form exits with
unexpected argument for change record: other.nix, because the-f|--filesbranch doesfiles+=("$2"); shift 2and the next loop iteration falls through to the catch-all*)arm.This matters more than the usual usage-text mismatch, because naming files explicitly is the documented way to avoid
record'sgit add -usweeping a concurrent agent's tracked edits in a shared checkout (issue #118). An agent that follows the usage text gets an abort instead, and the natural recovery — drop--files— is exactly the sweep the flag exists to prevent. The abort happens before anything is staged, so nothing is damaged; the cost is a failed step and a nudge toward the unsafe form.cli-design.mdcovers this directly: a plural flag name takes multiple values,--files a b cworks, repeating the flag accumulates, and the two forms combine; a following option ends the variadic list, so flag order stays free, and--ends option parsing so a value beginning with-stays reachable. It also says that when usage text and behaviour disagree, the default is to fix the behaviour rather than document the defect.Suggested shape: in the
-f|--filesbranch, consume following operands until the next--prefixed argument or the end of the arguments, requiring at least one (a list that consumed nothing is an error, never a silent fall back togit add -u). Repeating the flag should keep accumulating so existing call sites are unaffected.Same question probably applies to any other plural-named flag in the tool; a sweep for
+=("$2")next to a plural option name would find them.Already fixed. allod/tools#129 landed the variadic
-f|--filesparser on master and closed allod/tools#128, which reported this same defect in this same command a few hours before this issue was filed.This report was accurate about the tool it was running, which is why it does not read like a stale duplicate. The dev VM installs
allodfrom the deploy flake'sallod-toolspin, and that pin sat at90d68df— the commit immediately before the fix branch started. So the installed copy still carried the exactfiles+=("$2"); shift 2branch quoted above while master no longer had it anywhere. The lock has since been updated tocd40bb1and the VM rebuilt.Verified against the rebuilt tool on PATH:
An empty list refuses rather than falling back to the
git add -usweep, which was the safety concern this flag exists to serve (allod/tools#118).tests/allod-change.shcovers these forms; the suite is at 185 tests.The sweep suggested at the end of this issue was run across the whole repo —
allod,forge,pm/*,workspace/*,flake/*,git-hooks/*. There are no remaining+=("$2")branches behind a plural flag name, and--fileswas the only flag whose usage string ever promised a variadic list.flake-update-cascade <input-name>...is a variadic positional and collects all of its operands correctly.The sweep did surface a real inconsistency, which is not a bug:
allod change record --files a bis space-variadic, whileforge's multi-value flags (-l|--label,--add-label,--remove-label,--set) are singular-named and take comma-separated values with repetition accumulating. Tracked in allod/tools#131.Duplicate of #128.