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

Case insensitive sort_keys #2194

Open
DAVe3283 opened this issue Nov 13, 2024 · 0 comments
Open

Case insensitive sort_keys #2194

DAVe3283 opened this issue Nov 13, 2024 · 0 comments

Comments

@DAVe3283
Copy link

Please describe your feature request.
Ability to sort keys ignoring case (not case sensitive).

Describe the solution you'd like
If we have data1.yml like:

Foo: 3
apple: 1
bar: 2

And we run a command:

yq -P 'sort_keys_insensitive(..)' data1.yml

it could output

apple: 1
bar: 2
Foo: 3

Describe alternatives you've considered
I tried to use 'sort_keys(..|downcase)' but it does not work (probably as expected).

Additional context
While I don't want to consider case for the purpose of the sort, I would like to retain the case of the keys in the output.

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

No branches or pull requests

1 participant