diff options
-rw-r--r-- | bpkg/bpkg.cxx | 2 | ||||
-rw-r--r-- | bpkg/buildfile | 2 | ||||
-rw-r--r-- | bpkg/common-options.cli | 14 | ||||
-rw-r--r-- | bpkg/diagnostics | 14 | ||||
-rw-r--r-- | bpkg/rep-create.cxx | 9 |
5 files changed, 25 insertions, 16 deletions
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 176cc97..8811ba8 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -37,7 +37,7 @@ parse (const common_options& co, cli::scanner& s) // Trace verbosity. // - verb = o.verbose () > 0 ? o.verbose () : (o.v () ? 1 : 0); + verb = o.verbose_specified () ? o.verbose () : o.v () ? 2 : o.q () ? 0 : 1; return o; } diff --git a/bpkg/buildfile b/bpkg/buildfile index 97c56e5..7bcdab5 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -15,7 +15,7 @@ exe{bpkg}: cxx{diagnostics} cli.cxx{common-options} \ cli.options += -I $src_root --include-with-brackets --include-prefix bpkg \ --guard-prefix BPKG --generate-file-scanner --cli-namespace bpkg::cli \ ---generate-parse --long-usage --exclude-base +--generate-specifier --generate-parse --long-usage --exclude-base # Option length must be the same to get commands/topics/options lists # aligned in the general help. diff --git a/bpkg/common-options.cli b/bpkg/common-options.cli index ae18ead..a8b36de 100644 --- a/bpkg/common-options.cli +++ b/bpkg/common-options.cli @@ -11,14 +11,20 @@ namespace bpkg bool -v { "Print underlying commands being executed. This is equivalent to - \cb{--verbose 1}." + \cb{--verbose 2}." }; - std::uint16_t --verbose = 0 + bool -q + { + "Run quietly, only printing error messages. This is equivalent + to \cb{--verbose 0}." + }; + + std::uint16_t --verbose = 1 { "<level>", - "Set the diagnostics verbosity to <level> which can be between 0 - (disabled) and 5 (lots of information). @@ Need to document + "Set the diagnostics verbosity to <level> between 0 (disabled) and + 5 (lots of information). The default is 1. @@ Need to document further." }; diff --git a/bpkg/diagnostics b/bpkg/diagnostics index af9bde0..b672282 100644 --- a/bpkg/diagnostics +++ b/bpkg/diagnostics @@ -52,14 +52,14 @@ namespace bpkg print_process (args.data (), args.size ()); } - // Trace verbosity level. + // Verbosity level. // - // 0 - tracing disabled. - // 1 - TODO - // 2 - TODO - // 3 - TODO - // 4 - TODO - // 5 - TODO + // 0 - disabled + // 1 - general information messages + // 2 - underlying commands being executed + // 3 - information that could be helpful to the user + // 4 - information that could be helpful to the developer + // 5 - even more detailed information // // While uint8 is more than enough, use uint16 for the ease of printing. // diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 4ee2bab..1b8712a 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -95,7 +95,7 @@ namespace bpkg mf.string ().c_str (), nullptr}; - if (verb) + if (verb >= 2) print_process (args); try @@ -237,7 +237,9 @@ namespace bpkg { const package_manifest& m (p.second.second); - text << "adding " << m.name << " " << m.version; + if (verb) + text << "adding " << m.name << " " << m.version; + m.serialize (s); } @@ -252,7 +254,8 @@ namespace bpkg fail << "unable to write to " << p; } - text << pm.size () << " package(s)"; + if (verb) + text << pm.size () << " package(s)"; } catch (const invalid_path& e) { |