Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@clux
Copy link
Owner

@clux clux commented May 7, 2025

Adds input flags -J to alias --input=json and -T to alias --input=toml.

These do not clash with jq's cli flags.

Rationale and Caveats

A potentially scary thing about this approach is that we could not do this for any new format. E.g. if we added RON support, we would not be able to add -R shorthand for ron input because jq has a -R flag.

Thinking that these (less primary, potential future formats) will just have to deal with the explicit --input=ron style.

We could of course do the coreutils binary style thing, but the short xq style binary names are already very much taken. Soo, that would leave us with lqt / lqy / lqj etc for input, or lqyy / lqjt, or lq y, lq j, lq jt. Not nice.

In the end, going for this micro-optimisation because i write tools for myself that i want to be nice/convenient to use now, rather than idealistic for a future that probably never comes.

Adds input flags -J for json and -T for toml.
These do not clash with jq's cli flags.

A potentially scary thing about this approach is that we could not do this for any new format.
E.g. if we added RON support, we would not be able to add -R shorthand for ron input.

Thinking that these (less primary, potential future formats) will just have to deal with the explicit --input=ron style.

We could of course do the coreutils binary style thing, but the short xq style binary names are already very much taken.
Soo, that would leave us with lqt lqy lqj etc for input, or lqyy lqjt, or lq y, lq j, lq jt. Not nice.

In the end, going for this micro-optimisation because i write tools for myself that i want to be nice to use now, rather than idealistic for a future that probably never comes.

Signed-off-by: clux <[email protected]>
@clux clux marked this pull request as ready for review May 7, 2025 23:33
clux added 4 commits May 8, 2025 20:44
Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
@clux clux merged commit 130cd5f into main May 8, 2025
14 checks passed
@clux clux deleted the input-flag-alias-and-docs branch May 8, 2025 19:57
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.

1 participant