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

Function to format nicely big numbers: number-format.nu #332

Merged
merged 2 commits into from
Dec 23, 2022

Conversation

maxim-uvarov
Copy link
Contributor

image

--thousands_delim (-t) = ' '    # Thousands delimiter: number-format 1000 -t ': 1'000
--whole_part_length (-w) = 0    # Length of padding whole-part digits: number-format 123 -w 6:    123
--decimal_digits (-d) = 0       # Number of digits after decimal delimiter: number-format 1000.1234 -d 2: 1000.12 
--denom (-D) = ""               # Denom `--denom "Wt": number-format 1000 --denom 'Wt': 1000Wt

@fdncred
Copy link
Collaborator

fdncred commented Dec 23, 2022

This is cool!

It looks like formatting is a new folder, if so, can you please put a readme.md in that folder describing what this folder is intended to contain?

Also, I'm just passing this along, you don't have to use this, but there is a highlight function that could be used in your script too if you wanted the numbers to be highlighted like nushell does "123" | nu-highlight.

@maxim-uvarov
Copy link
Contributor Author

Thank you, Darren!
About the folder - I didn't find the better one to put this script into. So I created this one. Please, let me know if you have ideas of a better place.

P.S. While writing readme, I got some ideas of another useful functions of the category. I will try to implement them. Thanks

@fdncred
Copy link
Collaborator

fdncred commented Dec 23, 2022

Thanks! It would be nice to consolidate the folder names and meanings at some point but adding another one is fine for now.

@fdncred fdncred merged commit fdc2790 into nushell:main Dec 23, 2022
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.

2 participants