You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new set_default mechanism (and the combination with --quiet) allows setting the default level to warn -- something I highly appreciate.
The help text of --verbose, however, is built earlier than the set_default is evaluated (much earlier, in fact -- at build time). This means that programs that use set_default with anything but the built-in default Error get inconsistent help messages, ie. always
By default, it'll only report errors. Passing -v one time also prints
warnings, -vv enables info logging, -vvv debug, and -vvvv trace.
and not, say
By default, it'll only report errors and warnings. Passing -v one time
enables info logging, -vv debug, and -vvv trace.
I'm not well enough versed in structopt to propose any thought-through way toward resolution. One possibility would to add a generic argument to Verbosity that'd indicate the default and serve as help text; could look like
The current min-const-generics would require that there's a numeric level (and not an enum log::Level let alone Optionlog::Level) for some time -- and if it needs to go though a conversion (Verbosyty<DefaultVerbosity=default_level_from(Some(log::level::Warning))>), a "type-level enum" aka implementation-of-a-custom-trait might be more ergonomic still.
epage
added a commit
to epage/clap-verbosity-flag
that referenced
this issue
Sep 27, 2024
The new
set_default
mechanism (and the combination with --quiet) allows setting the default level to warn -- something I highly appreciate.The help text of
--verbose
, however, is built earlier than the set_default is evaluated (much earlier, in fact -- at build time). This means that programs that useset_default
with anything but the built-in default Error get inconsistent help messages, ie. alwaysand not, say
I'm not well enough versed in structopt to propose any thought-through way toward resolution. One possibility would to add a generic argument to Verbosity that'd indicate the default and serve as help text; could look like
and where the DefaultWarning struct provides something like
but as said, I don't know whether using that text would be doable with structopt.
The text was updated successfully, but these errors were encountered: