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

--from-file positional parameter not passed to jq since 2.3.5 #19

Closed
brydoncheyney opened this issue Feb 2, 2018 · 3 comments
Closed

Comments

@brydoncheyney
Copy link

brydoncheyney commented Feb 2, 2018

After changes made to passing positional parameters to jq, it looks like --from-file filter is broken and the filter for jq must be defined as the jq_filter of yq. This means you can no longer define filters in a file, which is invaluable for more complex constructs.

Example Setup

Define a filter and some yaml data

[yq] cat filter
.foo
[yq] cat data
foo
  a: 1

2.3.4

Positional arguments are broken

[yq] yq -y --arg a b . data
usage: yq [-h] [--yaml-output] [--width WIDTH] [--version]
          jq_filter [files [files ...]]
yq: error: argument files: can't open 'b': [Errno 2] No such file or directory: 'b'

--from-file without jq_filter works

[yq] yq -y --from-file filter data
a: 1

2.3.5

After changes to positional parameters, the --args example now works

[yq] yq -y --arg a b . data
foo:
  a: 1

...but the --from-file example is broken, returning the --help text with a return code 0.

[yq] yq -y --from-file filter data
usage: yq [options] <jq filter> [YAML file...]
          jq_filter [files [files ...]]

yq: Command-line YAML processor - jq wrapper for YAML documents
...
[yq] echo $?
0

trying to define the call with the self identify filter still fails to work, returning no error message but a return code of 2.

[yq] yq -y --from-file filter . data
[yq] echo $?
2
@brydoncheyney
Copy link
Author

Updated the issue after further investigation revealed the initial report was over simplified.

@brydoncheyney brydoncheyney changed the title Command line arguments to jq are broken since 2.3.5 --from-file positional parameter not passed to jq since 2.3.5 Feb 6, 2018
@kislyuk
Copy link
Owner

kislyuk commented Feb 7, 2018

Thank you for investigating. Looking into this.

@kislyuk kislyuk closed this as completed in fc4d0fe Feb 7, 2018
@kislyuk
Copy link
Owner

kislyuk commented Feb 7, 2018

This should be fixed in v2.3.7. Please test.

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

No branches or pull requests

2 participants