CLI tools - should help display by default?

61 views
Skip to first unread message

Glenn Block

unread,
Dec 31, 2011, 4:23:28 PM12/31/11
to nod...@googlegroups.com
I am sure there's no one answer to this, but interested in the philosophy of folks here. I am working on a CLI tool that has required params. I am using commander for handling the commands/options etc which works great. The question I had is with regard to usage info. This tool always requires you to choose something, so my question is should I display usage automatically if no commands are provided, OR should I say "use --help for a list of commands". 

Thanks
Glenn

Dean Landolt

unread,
Dec 31, 2011, 4:51:20 PM12/31/11
to nod...@googlegroups.com
On Sat, Dec 31, 2011 at 4:23 PM, Glenn Block <glenn...@gmail.com> wrote:
I am sure there's no one answer to this, but interested in the philosophy of folks here. I am working on a CLI tool that has required params. I am using commander for handling the commands/options etc which works great. The question I had is with regard to usage info. This tool always requires you to choose something, so my question is should I display usage automatically if no commands are provided, OR should I say "use --help for a list of commands". 


What's "use --help for al ist of commands" if not usage info? Why not go a step further, if possible, and preface this kind of message with the obvious common cases, if there are any. It can't hurt.

Glenn Block

unread,
Dec 31, 2011, 4:56:01 PM12/31/11
to nod...@googlegroups.com
I guess the real question I am asking is being that the command requires at least some params, does it make sense to even have --help? Or should it just print out the help for you and save you the command?

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Glenn Block

unread,
Dec 31, 2011, 4:56:35 PM12/31/11
to nod...@googlegroups.com
npm prints out the list of commands if you just type "npm"

On Sat, Dec 31, 2011 at 1:51 PM, Dean Landolt <de...@deanlandolt.com> wrote:

--

tjholowaychuk

unread,
Jan 1, 2012, 3:53:03 AM1/1/12
to nodejs
if there's nothing useful you can do with no args then definitely
treat it as --help IMHO, though often for example I would use it for
parsing from stdin, default path to CWD, etc, but it really depends on
the tool i guess

On Dec 31 2011, 1:56 pm, Glenn Block <glenn.bl...@gmail.com> wrote:
> npm prints out the list of commands if you just type "npm"
>
>
>
>
>
>
>
> On Sat, Dec 31, 2011 at 1:51 PM, Dean Landolt <d...@deanlandolt.com> wrote:

Glenn Block

unread,
Jan 1, 2012, 4:23:21 AM1/1/12
to tjholowaychuk, nodejs
Cool. In this case I think like npm there is not really a default
action.

Sent from my Windows Phone
From: tjholowaychuk
Sent: 1/1/2012 12:53 AM
To: nodejs
Subject: [nodejs] Re: CLI tools - should help display by default?

Pavan Kumar Sunkara

unread,
Jan 1, 2012, 7:44:40 AM1/1/12
to nod...@googlegroups.com, tjholowaychuk
Slightly off-topic, but a small spec to guide cli tools arguments

https://gist.github.com/1485856

PS: Tweet and blog about it if you think it's good.

Thanks
Pavan Kumar Sunkara

--
- Pavan Kumar Sunkara

Alan Gutierrez

unread,
Jan 2, 2012, 3:46:46 AM1/2/12
to nod...@googlegroups.com
On 1/1/12 7:44 AM, Pavan Kumar Sunkara wrote:
> Slightly off-topic, but a small spec to guide cli tools arguments
>
> https://gist.github.com/1485856
>
> PS: Tweet and blog about it if you think it's good.

Did you read through any past discussions on command line argument
conventions? Is there a bibliography?

http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

Seems like a good thing to do, to create a Tweetable gist of conventions
for people to pass around.

--
Alan Gutierrez

Pavan Kumar Sunkara

unread,
Jan 2, 2012, 11:32:23 PM1/2/12
to nod...@googlegroups.com
> Did you read through any past discussions on command line argument
> conventions? Is there a bibliography?
>
> http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
>
> Seems like a good thing to do, to create a Tweetable gist of conventions for
> people to pass around.
>
> --
> Alan Gutierrez

Yes, I read almost all past conventions on command line arguments
including the link you gave me before writing the gist.

I just expanded the existing conventions with my spec.

Thanks

Reply all
Reply to author
Forward
0 new messages