Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@andreasgerstmayr
Copy link

This commit updates the CLI arguments to accept either a file containing
a json pointer expression, or an expression as a commandline argument:

usage: jsonpointer [-h] (-f [POINTER_FILE] | -p [POINTER]) [--indent INDENT] [-v] FILE [FILE ...]

Without this commit

jsonpointer "/a" a.json b.json

works fine, however using a file doesn't work:

$ jsonpointer -f ptr.json a.json b.json
usage: jsonpointer [-h] [-f [POINTER_FILE]] [--indent INDENT] [-v] [POINTER] FILE [FILE ...]
jsonpointer: error: argument POINTER: not allowed with argument -f/--pointer-file

This commit also improves the usage message by explaining the mutually exclusive arguments,
adds tests for the changes, updates the documentation and adds a new CHANGELOG.md file.

Resolves #43

@coveralls
Copy link

coveralls commented Aug 5, 2021

Coverage Status

Coverage remained the same at 100.0% when pulling e0c81d7 on andreasgerstmayr:fix-cli-args into 7d146bd on stefankoegl:master.

This commit updates the CLI arguments to accept either a file containing
a json pointer expression, or an expression as a commandline argument:

    usage: jsonpointer [-h] (-f [POINTER_FILE] | -p [POINTER]) [--indent INDENT] [-v] FILE [FILE ...]

Without this commit

    jsonpointer "/a" a.json b.json

works fine, however using a file doesn't work:

    $ jsonpointer -f ptr.json a.json b.json
    usage: jsonpointer [-h] [-f [POINTER_FILE]] [--indent INDENT] [-v] [POINTER] FILE [FILE ...]
    jsonpointer: error: argument POINTER: not allowed with argument -f/--pointer-file

This commit also improves the usage message by explaining the mutually exclusive arguments,
adds tests for the changes, updates the documentation and adds a new CHANGELOG.md file.

Resolves stefankoegl#43
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.

Parsing of command-line arguments is broken

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.