dbuenzli / logs

Logging infrastructure for OCaml
http://erratique.ch/software/logs
ISC License
87 stars 19 forks source link

Logs_cli's UI is very bad #13

Closed dbuenzli closed 8 years ago

dbuenzli commented 8 years ago

Currently the verbosity option has an optional argument.

-q, --quiet
       Be quiet. Takes over --verbose.
-v [LEVEL], --verbose[=LEVEL] (default=info) (absent=warning or TOOL_VERBOSE env)
       Be more or less verbose. LEVEL must be one of `quiet', `error',
       `warning', `info' or `debug'.

However given Cmdliner's flexible command line parsing where options arguments are allowed to be glued or not to the option, this interacts badly with positional arguments. For example:

./tool.native -v arg 
tool: option `-v': invalid value `arg', expected one of `quiet', `error',
         `warning', `info' or `debug'

This problem is of course present with any option that has optional arguments. I actually wonder if supporting options with non-glued optional arguments in Cmdliner was a good idea in the first place, it seems to increase cli's ambiguity.

I think we should have a -v whose repetition simply increases verbosity and a --verbosity=LEVEL option that takes over -v options. -q still takes over both -v and --verbosity.