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

nix/*: Add `-h`-shortcut for `--help` to display helptext #3760

Closed
wants to merge 1 commit into from

Conversation

@Ma27
Copy link
Member

Ma27 commented Jun 29, 2020

I'm used to pass -h to a command to read a helptext and always having
to type --help is slightly annoying.

I'm used to pass `-h` to a command to read a helptext and always having
to type `--help` is slightly annoying.
@edolstra
Copy link
Member

edolstra commented Jun 29, 2020

I don't think -h is actually that common. For instance, the GNU commands don't seem to support it. (Some of them use it as a shortcut for --human-readable, which might be useful for commands like nix path-info --closure-size). We have to be careful about introducing global one-character flags since it's a pretty limited namespace.

@Ma27
Copy link
Member Author

Ma27 commented Jun 29, 2020

I don't think -h is actually that common. For instance, the GNU commands don't seem to support it.

OTOH a lot of other devtools (e.g. python3, cargo, node and so on) use -h.

(Some of them use it as a shortcut for --human-readable, which might be useful for commands like nix path-info --closure-size). We have to be careful about introducing global one-character flags since it's a pretty limited namespace.

Ah right, missed that one. But -h for all commands seems to be a far more common use-case to me. Is there any reason not to use -H for --human-readable there? I mean, the nix-command is marked as experimental anyways and thus subject to change.

@Ma27
Copy link
Member Author

Ma27 commented Jul 16, 2020

ping @edolstra any updates on this?

@zimbatm
Copy link
Member

zimbatm commented Jul 16, 2020

There are other tools such as GNU coreutils and git that only accept --help so -h is not universal. Since the nix cli is a command dispatcher, it's probably best to keep the single-char flags for the target commands.

@Ma27
Copy link
Member Author

Ma27 commented Jul 17, 2020

yeah but it's becoming more and more common which is why I personally think that this is an actual (though small) improvement. However, if I'm in a minority here, I'll close this :)

@davidak
Copy link
Member

davidak commented Jul 24, 2020

I don't think -h is actually that common. For instance, the GNU commands don't seem to support it.

GNU recommends to use the long version while the short version is used in UNIX.

Please define long-named options that are equivalent to the single-letter Unix-style options. We hope to make GNU more user friendly this way.

https://softwareengineering.stackexchange.com/a/307472/193427
https://www.gnu.org/prep/standards/standards.html#Command_002dLine-Interfaces
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html

I provide both when possible. At least often used parameters should have a short version.

@bhipple
Copy link
Contributor

bhipple commented Jul 25, 2020

I very frequently use nix path-info -rhsS | sort -hk3 to see a closure, and the cmdline consistency with all the common coreutils tools is nice!

@Ma27
Copy link
Member Author

Ma27 commented Aug 1, 2020

Closing for now. While I like -h as shorthand for --help, it seems as there are a lot of folks against this, also we'd already have to change e.g. the nix path-info arg (and work around even more conflicts in the future).

@Ma27 Ma27 closed this Aug 1, 2020
@Ma27 Ma27 deleted the Ma27:nix-cmd-help-shortcut branch Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.