Reform positional argument parsing #523
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This diff makes positional argument parsing much cleaner, along with
adding a bunch of tests. Just's positional argument parsing is rather,
complex, so hopefully this reform allows it to both be correct and stay
correct.
User-visible changes:
just ..
is now accepted, with the same effect asjust ../
just .
is also accepted, with the same effect asjust
It is now an error to pass arguments or overrides to subcommands
that do not accept them, namely
--dump
,--edit
,--list
,--show
, and--summary
. It is also an error to pass arguments to--evaluate
, although--evaluate
does of course still acceptoverrides.
(This is a breaking change, but hopefully worth it, as it will allow us
to add arguments to subcommands which did not previously take
them, if we so desire.)
Subcommands which do not accept arguments may now accept a
single search-directory argument, so
just --list ../
andjust --dump foo/
are now accepted, with the former starting thesearch for the justfile to list in the parent directory, and the latter
starting the search for the justfile to dump in
foo
.Fixes #147, #499, and #518.