mkideal / cli

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

Need separator to arrange parameters in groups #48

Closed suntong closed 6 years ago

suntong commented 6 years ago

This is for better usage() output.

E.g.,

from

Options:

  -h, --help        display help information 
  -c, --config      config file [=wireframe_cfg.json]
  -H, --host        host addr [=$HOST]
  -p, --port        listening port 
  -D, --daemonize   daemonize the service 
  -o, --output      The output file (default: some file)
  -v, --verbose     Verbose mode (Multiple -v options increase the verbosity.) 

to

Options:

  -h, --help        display help information 

  -c, --config      config file [=wireframe_cfg.json]

  -H, --host        host addr [=$HOST]
  -p, --port        listening port 

  -D, --daemonize   daemonize the service 
  -o, --output      The output file (default: some file)
  -v, --verbose     Verbose mode (Multiple -v options increase the verbosity.) 

Note that adding \n at the end of usage text will not always work, for e.g., the above --config/--host case because the defaults are added after the user provided usage text.

mkideal commented 6 years ago

Okay. I have fixed it, See commit 93c4a12 for detail.

mkideal commented 6 years ago

And, add a new example 031

suntong commented 6 years ago

Thx @mkideal, I'd have to test what happens when there is an extreme long usage text that need to spread across multi-lines, and get back to you...

suntong commented 6 years ago

Perfect!