Fix usage text #126
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The usage text in utilities and manpages is all over the place and needs a sense of cohesiveness. So far, the CONDUCT file has specified the NetBSD coding standards as the Bonsai coding standards. This is a discussion thread on this issue.
My usage text guidelines are as follows:
[description]
.(description)
.(-n [argument])
.When you put it together you can get usages like
Usage: util (-abc) (-d [arg]) [argument] (argument)
that give you an idea of what your program invocation is missing without distracting with syntax.I like the NetBSD guidelines but I have found these to be clearer.
I dislike the nested brackets; plus, they make it look like arguments are optional.
NetBSD’s is very clear:
usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\n
Yours is noisy when options have arguments and seem to imply that they are optional (since they are in brackets, though it’s not entirely clear):
usage: f (-aDde) (-b [b_arg]) (-m [m_arg]) [req1] [req2] (opt1 (opt2))\n
I like the way this looks, though:
usage: f (-aDde) (-b b_arg) (-m m_arg) req1 req2 (opt1 (opt2))\n
It is a well established convention that square brackets mean something is optional. Breaking that would cause much confusion for users, especially if it isn't explained to them.
This is one of the many cases where the principle of least astonishment is very applicable.
Count me in to NetBSD style.
I failed to elaborate on one of my thoughts; while parens are nice, l think deferring to NetBSD's judgement unmodified is wiser. Then we can simply refer people to their documentation for option syntax.
I still prefer my proposed option syntax but I think principle of least astonishment trumps my opinion. Also, NetBSD is a >30 year old project with impeccable code quality and one of the most polite and helpful development communities on the Internet.