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

tomlq: -i/--in-place can only be used with -y/-Y #130

Closed
dcompoze opened this issue Aug 11, 2021 · 2 comments · Fixed by #171
Closed

tomlq: -i/--in-place can only be used with -y/-Y #130

dcompoze opened this issue Aug 11, 2021 · 2 comments · Fixed by #171

Comments

@dcompoze
Copy link

dcompoze commented Aug 11, 2021

Version: tomlq 2.12.2

The --help documentation says that it's possible to update in place using the -i flag:

  -h, --help         show this help message and exit
  --toml-output, -t  Transcode jq JSON output back into TOML and emit it
  --in-place, -i     Edit files in place (no backup - use caution)

But when invoked I get an error:

tomlq: -i/--in-place can only be used with -y/-Y

Which seems to suggest that only yaml files can be updated in-place.

I ended up using the sponge utility from the moreutils package: tomlq --toml-output '<query>' Foo.toml | sponge Foo.toml. But since tomlq already knows how to return toml output it would seem rather straight-forward to make the -i flag work the same way it works with yq.

@kislyuk
Copy link
Owner

kislyuk commented Aug 11, 2021

Correct, sponge is the right utility to use in this case. jq does not support -i, so -i is only available when we are capturing and converting jq's output.

@kislyuk kislyuk closed this as completed Aug 11, 2021
@kislyuk kislyuk reopened this Aug 11, 2021
@kislyuk
Copy link
Owner

kislyuk commented Aug 11, 2021

Sorry, I misread that. What you're pointing out is a bug. tomlq -t should support -i.

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 a pull request may close this issue.

2 participants