Skip to content

Inconsistent placement of options #3

Description

@dmyersturnbull

Great package! I just wrote a tiny pre-commit hook for it. I'm seeing a couple limitations (I'll open an Issue for each).

Restricted to before the command

-v, --debug, --filename, --platform, and --max-len are only allowed before the command, but e.g. pathvalidate -v validate and pathvalidate validate -v should probably both work.

$ pathvalidate validate -v x
# [...]
Error: No such option: -v

Ironically, any unrecognized value starting with - is treated as an option anyway, and the POSIX standard -- is handled correctly, so there's no advantage to the current behavior:

$ pathvalidate -v validate -x
# [...]
Error: No such option: -x

$ # `--` is skipped:
$ pathvalidate -v validate -- -x
[INFO] -x is a valid path for universal

Restricted to after

--min-len and --no-check-reserved are like this.

$ pathvalidate --min-len 100 validate x
error: unexpected argument '--min-len' found

  tip: a similar argument exists: '--find-links'

Usage: uvx [OPTIONS] [COMMAND]

For more information, try '--help'.

Incidentally, validate --max-len suggests you meant --min-len:

$ pathvalidate validate --max-len 100 x
# [...]
Error: No such option: --max-len Did you mean --min-len?

Fixing this

Click is evidently already treating -- correctly. I haven't used Click directly before, only typer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions