mkideal / cli

CLI - A package for building command line app with go
MIT License
732 stars 43 forks source link

Usage text for sub commands #32

Closed suntong closed 7 years ago

suntong commented 7 years ago

Hi Pal,

Are we able to provide usage text for sub commands?

When there is no sub-commands, I can manage to get an output like this:

$ picv -h
picture vault
built on 2017-06-03

Tool to deal with camera pictures and put them in vault

Usage:
  picv [Options] dir [dirs...]

Options:

  -h, --help       display help information
 ...

Notice that "Usage:" line? It's come from here.

However when with sub commands, how can I provide a "Usage:" text like above, into the following?

$ picv cut -h 
Separate picture into groups

Options:

  -h, --help       display help information
 ...

Thanks

suntong commented 7 years ago

Hi @mkideal,

I DO need that, so I don't mind to roll up the sleeves and patch it myself -- adding another field that does just that. One thing I'm not sure is, whether we should call this extra fields Usage or Details, or something else?

What do you think? OK to call it Usage? I haven't look into the code yet, hope it'll be any easy fix that you will accept my PR.

Thanks

suntong commented 7 years ago

Oops, sorry, stupid me, I think using the Text is just fine. Sorry.