dbuenzli / logs

Logging infrastructure for OCaml

Home Page:http://erratique.ch/software/logs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logs_cli's UI is very bad

dbuenzli opened this issue · comments

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.