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

Suggestion: Add an entrypoint and/or scripts for command-line use #184

Open
sakurai-youhei opened this issue Apr 24, 2024 · 1 comment · May be fixed by #185
Open

Suggestion: Add an entrypoint and/or scripts for command-line use #184

sakurai-youhei opened this issue Apr 24, 2024 · 1 comment · May be fixed by #185

Comments

@sakurai-youhei
Copy link

Thank you for your great project!

Google always guides me to https://stackoverflow.com/a/15485265, which suggests humanize.naturalsize(). I'm ok to type in ipython, and copy & paste import humanize and humanize.naturalsize().

But it'd be more than great if this small task could be simplified in something like these ways.

$ naturalsize 8589934592
8.6 GB
$ naturalsize --binary 8589934592
8.0 GiB
$ echo 8589934592 | python -m humanize naturalsize --format "%.3f"
8.590 GB

There are tools such as numfmt, but pip install is easier for me as a Windows user. :)

I'd open a PR if I found some time for this. But I can't promise my contribution. So, I'm filing just an idea here.

@hugovk
Copy link
Member

hugovk commented Apr 25, 2024

Interesting idea!

I think there are too many functions altogether, some with too generic names, to add them all.

We could do just a few, but it might be better to have humanize as the main command, so you'd run something like humanize naturalsize 8589934592.

And also a python -m humanize naturalsize 8589934592 could be useful too.

@sakurai-youhei sakurai-youhei linked a pull request Apr 29, 2024 that will close this issue
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