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

Add verbs to lowercase/uppercase keys #1215

Closed
johnkerl opened this issue Mar 3, 2023 · 5 comments
Closed

Add verbs to lowercase/uppercase keys #1215

johnkerl opened this issue Mar 3, 2023 · 5 comments

Comments

@johnkerl
Copy link
Owner

johnkerl commented Mar 3, 2023

Nice! If there were also a verb to change the case of keys (e.g. lowercase, uppercase), fields could be normalized across different files without having to use the nuclear $ = {} option in a put expression 👍

Originally posted by @archetyped in #1167 (comment)

@johnkerl
Copy link
Owner Author

johnkerl commented Mar 4, 2023

@archetyped #1217

@archetyped
Copy link

Nice! Do you think it would be more flexible or easier to manage if all case manipulation was under a single verb (e.g. case or change-case) with transformations passed as options (e.g. -l for lowercase, -u for uppercase, etc.)?

This allows for additional transformations (title case, sentence case, etc.) to all live under a single verb, rather than expanding the verb-space.

Certain case transformations are particularly useful when working with values (e.g. title case), so an option to specify fields for the verb to act on (like unsparsify) would be great.

@johnkerl
Copy link
Owner Author

johnkerl commented Jun 4, 2023

On #1215:

  • mlr upcase is mlr case -u
  • mlr downcase is mlr case -l
  • New options -s and -t for sentence-case and title-case
  • New -f to specify field names to be operated on (default all)

Note the first two bullets are backward-incompatible with head but not with any previously released Miller version.

@johnkerl
Copy link
Owner Author

johnkerl commented Jun 4, 2023

@archetyped I believe #1215 resolves this -- if not please let me know and we can re-open -- thanks!

@johnkerl johnkerl closed this as completed Jun 4, 2023
@archetyped
Copy link

@johnkerl looks great, thanks!

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

2 participants