Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reform positional argument parsing #523

Merged
merged 1 commit into from
Nov 11, 2019
Merged

Reform positional argument parsing #523

merged 1 commit into from
Nov 11, 2019

Conversation

casey
Copy link
Owner

@casey casey commented Nov 11, 2019

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 as just ../

  • just . is also accepted, with the same effect as just

  • 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 accept
    overrides.

    (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 ../ and
    just --dump foo/ are now accepted, with the former starting the
    search 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.

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.

As part of the reform, `just ..` will now work, and has the same effect
as `just ../`. `just .` is also accepted, but is a noop.

As part of this change, 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 accept overrides.

The above is a breaking change, but hopefully one which is worth it, as it
will allow us to add arguments to subcommands which did not previously
take them, if we so desire.
@casey casey merged commit 177516b into master Nov 11, 2019
@casey casey deleted the argparse branch November 11, 2019 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow path-only argument with flags like -l
1 participant