output which should be suppressed by --silent option.
- some output clean-up (still work to do)
-TODO
+0.9.0
+
+- implement all rug commands (where it has sense)
+- clean up and improve output, add --silent mode, sort normal, verbose
+ and debug output.
+- refresh - show progress on default output, verbose progress with -v
+
+
+NOT SCHEDULED
+-------------
General
-- implement all rug commands, if only to say: Not implemented (yet)
- script progress: does the output contain newline??
- installation and deletion notifications
- --dry-run (use ZYppCommitPolicy.h)
(svn up ncurses)
- reboot-needed: ?
- cron updater:
--- wrapper script for restart-packager
+- wrapper script for restart-packager
- zypper patch-search (for rug compatibility)
Packages
.I \-v, \-\-verbose
Increase verbosity. For debugging output specify this option twice.
.TP
+.I \-S, \-\-silent
+Suppress normal output. Brief error messages will still be printed on standard error output. If used together with conflicting --verbose option, the --verbose option takes preference.
+.TP
.I \-t, \-\-terse
Terse output for machine consumption.
.TP
-------------------------------------------------------------------
+Thu Jul 5 23:06:49 CEST 2007 - jkupec@suse.cz
+
+- --silent global option added. Use cout_n for normal program
+ output which should be suppressed by --silent option.
+- some output clean-up (still work to do)
+- r5898
+
+-------------------------------------------------------------------
Tue Jul 3 13:34:09 CEST 2007 - jkupec@suse.cz
- adapted to refactored libzypp repository management
//template<typename Action>
//Action ...
int read_action_ari (int default_action) {
- cout << _("(A)bort, (R)etry, (I)gnore?") << " "; // don't translate letters in parentheses!!
+ if (gSettings.verbosity >= 0 || !gSettings.non_interactive)
+ // TranslatorExplanation don't translate letters in parentheses!!
+ cout << _("(A)bort, (R)etry, (I)gnore?") << " ";
- // abort if no default has been specified
+ // choose abort if no default has been specified
if (default_action == -1) {
default_action = 0;
}
default: c = '?';
}
// print the answer for conveniecne
- cout << c << endl;
+ cout_n << c << endl;
return default_action;
}
return 1;
else if (c == 'i')
return 2;
- cout << "?" << endl;
+ cerr << _("Invalid answer. Choose letter a, r, or i.") << endl;
}
return default_action;
*/
void printPkgInfo(const PoolItem & pool_item, const PoolItem & ins_pool_item) {
- cout << _("Catalog: ") << pool_item.resolvable()->repository().info().alias() << endl;
+ cout << (gSettings.is_rug_compatible ? _("Catalog: ") : _("Repository: "))
+ << pool_item.resolvable()->repository().info().alias() << endl;
cout << _("Name: ") << pool_item.resolvable()->name() << endl;
cout << _("Version: ") << pool_item.resolvable()->edition().asString() << endl;
cout << _("Arch: ") << pool_item.resolvable()->arch().asString() << endl;
cout << _("Installed Size: ") << pool_item.resolvable()->size().asString() << endl;
cout << _("Summary: ") << pool_item.resolvable()->summary() << endl;
cout << _("Description: ") << endl;
-
cout << pool_item.resolvable()->description() << endl;
}
// name and kind match:
ProvideProcess installer (God->architecture(), "" /*version*/);
- cerr_vv << "Iterating over [" << kind << "]" << name << endl;
+ cout_vv << "Iterating over [" << kind << "]" << name << endl;
invokeOnEach( pool.byNameBegin( name ),
pool.byNameEnd( name ),
resfilter::ByKind( kind ),
zypp::functor::functorRef<bool,const zypp::PoolItem&> (installer)
);
- cerr_vv << "... done" << endl;
+ cout_vv << "... done" << endl;
if (!installer.item) {
- cerr << kind << " '" << name << "' " << _("not found") << endl;
- return; //error?
+ // TranslatorExplanation e.g. "package 'pornview' not found"
+ cerr << format(_("%s '%s' not found")) % kind % name << endl;
+ WAR << format("%s '%s' not found") % kind % name << endl;
+
+ return;
}
if (installer.installed_item &&
installer.installed_item.resolvable()->edition() == installer.item.resolvable()->edition() &&
installer.installed_item.resolvable()->arch() == installer.item.resolvable()->arch()) {
- cout << _("skipping ") << kind.asString() << " '" << name << "' " << _("(already installed)") << endl;
+ cout_n << _("skipping ") << kind.asString() << " '" << name << "' " << _("(already installed)") << endl;
}
else {
// TODO don't use setToBeInstalled for this purpose but higher level solver API
bool result = installer.item.status().setToBeInstalled( zypp::ResStatus::USER );
if (!result) {
cerr << format(_("Failed to add '%s' to the list of packages to be installed.")) % name << endl;
+ ERR << "Could not set " << name << " as to-be-installed" << endl;
}
}
}
bool operator() ( const PoolItem& provider )
{
found = true;
- cerr_vv << "Marking for deletion: " << provider << endl;
+ cout_vv << "Marking for deletion: " << provider << endl;
bool result = provider.status().setToBeUninstalled( zypp::ResStatus::USER );
if (!result) {
- cerr << _("Failed") << endl;
+ cerr << format(
+ _("Failed to add '%s' to the list of packages to be removed."))
+ % provider.resolvable()->name() << endl;
+ ERR << "Could not set " << provider.resolvable()->name()
+ << " as to-be-uninstalled" << endl;
}
return true; // get all of them
}
void load_target_resolvables()
{
- cout << _("Reading RPM database...") << endl;
+ cout_n << _("Reading RPM database...");
+ MIL << "Going to read RPM database" << endl;
+
ResStore tgt_resolvables(God->target()->resolvables());
- cout_v << " " << format(_("%s resolvables.")) % tgt_resolvables.size() << endl;
+
+ cout_v << " " << format(_("(%s resolvables)")) % tgt_resolvables.size();
+ cout_n << endl;
+ DBG << tgt_resolvables.size() << " resolvables read";
+
God->addResolvables(tgt_resolvables, true /*installed*/);
}
tbl << tr;
}
tbl.sort (1); // Name
- cout << tbl;
+
+ if (tbl.empty())
+ cout_n << _("No needed patches found.") << endl;
+ else
+ // display the result, even if --silent specified
+ cout << tbl;
}
// ----------------------------------------------------------------------------
tbl.sort (1); // Name
if (tbl.empty())
- cout << _("No updates found.") << endl;
+ cout_n << _("No updates found.") << endl;
else
cout << tbl;
}
tbl.sort (gSettings.is_rug_compatible? 3: 2); // Name
if (tbl.empty())
- cout << _("No updates found.") << endl;
+ cout_n << _("No updates found.") << endl;
else
cout << tbl;
}
#include <iostream>
#include <string>
+#include <boost/format.hpp>
+
#include <zypp/base/Logger.h>
#include <zypp/ZYppCallbacks.h>
#include <zypp/Package.h>
{
virtual void show( zypp::Message::constPtr message )
{
- cerr_v << message << endl; // [message]important-msg-1.0-1
- std::cerr << message->text() << endl;
- // TODO in interactive mode, wait for ENTER?
+ cout_v << message << endl; // [message]important-msg-1.0-1
+ cout_n << message->text() << endl;
+ //! \todo in interactive mode, wait for ENTER?
}
};
-#ifndef LIBZYPP_1xx
ostream& operator<< (ostream& stm, zypp::target::ScriptResolvableReport::Task task) {
return stm << (task==zypp::target::ScriptResolvableReport::DO? "DO": "UNDO");
}
virtual void start( const zypp::Resolvable::constPtr & script_r,
const zypp::Pathname & path_r,
Task task) {
- cerr << "Running: " << script_r
- << " (" << task << ", " << path_r << ")" << endl;
+ // TranslatorExplanation speaking of a script
+ cout_n << boost::format(_("Running: %s (%s, %s)"))
+ % script_r % task % path_r << endl;
}
/** Progress provides the script output. If the script is quiet ,
* from time to time still-alive pings are sent to the ui. (Notify=PING)
virtual bool progress( Notify kind, const std::string &output ) {
if (kind == PING) {
static AliveCursor cursor;
- cerr_v << '\r' << cursor++ << flush;
+ cout_v << '\r' << cursor++ << flush;
}
else {
- cerr << output << flush;
+ cout_n << output << flush;
}
// hmm, how to signal abort in zypper? catch sigint? (document it)
return true;
}
};
-#endif
///////////////////////////////////////////////////////////////////
struct ScanRpmDbReceive : public zypp::callback::ReceiveReport<zypp::target::rpm::ScanDBReport>
{
virtual void start( zypp::Resolvable::constPtr resolvable )
{
- std::cerr << "Removing: " << *resolvable << std::endl;
+ cout << boost::format(_("Removing: %s-%s"))
+ % resolvable->name() % resolvable->edition() << endl;
}
virtual bool progress(int value, zypp::Resolvable::constPtr resolvable)
#include <zypp/Digest.h>
#include <zypp/Url.h>
+#include "zypper.h"
#include "zypper-callbacks.h"
///////////////////////////////////////////////////////////////////
{
_delta = filename;
_delta_size = downloadsize;
- std::cerr << "Downloading delta: "
- << _delta << ", " << _delta_size << std::endl;
+ cout_n << "Downloading delta: "
+ << _delta << ", " << _delta_size << std::endl;
}
virtual bool progressDeltaDownload( int value )
{
display_done ();
}
-
+
// Apply delta rpm:
// - local path of downloaded delta
// - aplpy is not interruptable
virtual void startDeltaApply( const zypp::Pathname & filename )
{
_delta = filename;
- std::cerr << "Applying delta: " << _delta << std::endl;
+ cout_n << "Applying delta: " << _delta << std::endl;
}
-
+
virtual void progressDeltaApply( int value )
{
display_step( "Applying delta " /* + _delta.asString()*/, value );
}
-
+
virtual void problemDeltaApply( const std::string & description )
{
std::cerr << description << std::endl;
}
-
+
virtual void finishDeltaApply()
{
display_done ();
}
-
+
// Dowmload patch rpm:
// - path below url reported on start()
// - expected download size (0 if unknown)
{
_patch = filename;
_patch_size = downloadsize;
- std::cerr << "Downloading patch.rpm: "
+ cout_n << "Downloading patch.rpm: "
<< _patch << ", " << _patch_size << std::endl;
}
{
_resolvable_ptr = resolvable_ptr;
_url = url;
- std::cerr << "Downloading: " << _resolvable_ptr;
+ cout_n << "Downloading: " << _resolvable_ptr;
// grr, bad class??
// zypp::ResObject::constPtr ro =
// dynamic_pointer_cast<const zypp::ResObject::constPtr> (resolvable_ptr);
zypp::Package::constPtr ro = zypp::asKind<zypp::Package> (resolvable_ptr);
if (ro) {
- std::cerr << ", " << ro->archivesize ()
+ cout_n << ", " << ro->archivesize ()
<< "(" << ro->size () << " unpacked)";
}
- std::cerr << std::endl;
+ cout_n << std::endl;
}
// return false if the download should be aborted right now
if (do_refresh)
{
//! \todo progress reporting
- cout << "Refreshing " << repo.alias() << endl;
+ cout_n << "Refreshing " << repo.alias() << endl;
manager.refreshMetadata(repo);
}
}
tbl << tr;
}
- cout << tbl;
+
+ if (tbl.empty())
+ cout_n << _("No repositories defined."
+ " Use 'zypper addrepo' command to add one or more repositories.")
+ << endl;
+ else
+ cout << tbl;
}
// ----------------------------------------------------------------------------
}
catch ( const Exception &e )
{
- cerr << _("Error reading system sources: ") << endl
- << e.msg() << endl;
+ ZYPP_CAUGHT(e);
+ cerr << _("Error reading system sources:") << endl
+ << e.asUserString() << endl;
exit(ZYPPER_EXIT_ERR_ZYPP);
}
try
{
- cout << _("Refreshing ") << it->alias() << endl;
- //<< "URI: " << it->url() << endl;
+ cout_n << _("Refreshing ") << it->alias() << endl;
+ manager.refreshMetadata(repo); //! \todo progress reporting
- manager.refreshMetadata(repo);
cout_v << _("Creating repository cache...") << endl;
manager.buildCache(repo);
- cout << _("DONE") << endl << endl;
+ cout_n << _("DONE") << endl << endl;
}
catch ( const Exception &e )
{
- cerr << format(_("Error reading repository '%s':")) % repo.alias() << endl
- << e.msg() << endl;
+ cerr << format(_("Error reading repository '%s':")) % repo.alias()
+ << endl << e.msg() << endl;
cerr << format(_("Skipping repository '%s' because of the above error."))
- % repo.alias()
- << endl;
+ % repo.alias() << endl;
+ // log untranslated message
+ ERR << format("Error reading repository '%s':") % repo.alias()
+ << endl << e.msg() << endl;
+ ERR << format("Skipping repository '%s' because of the above error.")
+ % repo.alias() << endl;
}
}
- cout << _("All system sources have been refreshed.") << endl;
+ cout_n << _("All system sources have been refreshed.") << endl;
}
// ----------------------------------------------------------------------------
RepoManager manager;
cout_v << format(_("Adding repository '%s'.")) % repo.alias() << endl;
+ MIL << "Going to add repository: " << repo << endl;
try
{
}
catch (const MediaException & e)
{
- cerr << "Problem transfering repository data for reading." << endl;
+ cerr << _("Problem transfering repository data from specified URL.") << endl;
+ ERR << "Problem transfering repository data from specified URL." << endl;
return ZYPPER_EXIT_ERR_ZYPP;
}
catch (const ParseException & e)
{
- cerr << "Problem while reading repository data." << endl;
+ cerr << _("Problem parsing repository data.") << endl;
+ ERR << "Problem parsing repository data." << endl;
return ZYPPER_EXIT_ERR_ZYPP;
}
catch (const RepoAlreadyExistsException & e)
{
- string message = _(
- "A repository named '%s'."
- " already exists.");
- cerr << format(message) % repo.alias() << endl;
+ cerr << format("Repository named '%s' already exists.") % repo.alias() << endl;
+ ERR << "Repository named '%s' already exists." << endl;
return ZYPPER_EXIT_ERR_ZYPP;
}
catch (const Exception & e)
{
- cerr << e.msg() << endl;
+ ZYPP_CAUGHT(e);
+ cerr << e.asUserString() << endl;
return ZYPPER_EXIT_ERR_BUG;
}
- cout << format(_("Repository '%s' successfully added:")) % repo.alias() << endl;
- cout << ( repo.enabled() ? "[x]" : "[ ]" );
- cout << ( repo.autorefresh() ? "* " : " " );
- cout << repo.alias() << " (" << *repo.baseUrlsBegin() << ")" << endl;
+ cout_n << format(_("Repository '%s' successfully added:")) % repo.alias() << endl;
+ cout_n << ( repo.enabled() ? "[x]" : "[ ]" );
+ cout_n << ( repo.autorefresh() ? "* " : " " );
+ cout_n << repo.alias() << " (" << *repo.baseUrlsBegin() << ")" << endl;
+
+ MIL << "Repository successfully added: " << repo << endl;
return ZYPPER_EXIT_OK;
}
cerr << format(_(
"Warning! Overriding detected repository type '%s' with "
"manually specified '%s'.")) % repotype_probed % repotype
- << endl;
+ << endl;
+ WAR << format(
+ "Overriding detected repository type '%s' with "
+ "manually specified '%s'.") % repotype_probed % repotype
+ << endl;
}
}
catch (RepoUnknownTypeException & e)
{
string message = _(
- "Warning: Unknown repository type '%s'."
+ "Unknown repository type '%s'."
" Using detected type '%s' instead.");
cerr << format(message) % type % repotype_probed << endl;
+ WAR << format("Unknown repository type '%s'."
+ " Using detected type '%s' instead.") % type % repotype_probed << endl;
+
repotype = repotype_probed;
}
}
{
manager.modifyRepository(alias, repo);
- cout << format(_("Repository %s renamed to %s")) % alias % repo.alias() << endl;
+ cout_n << format(_("Repository %s renamed to %s")) % alias % repo.alias() << endl;
+ MIL << format(_("Repository %s renamed to %s")) % alias % repo.alias() << endl;
}
catch (const Exception & ex)
{
cerr << _("Error while modifying the repository:") << endl;
cerr << ex.asUserString();
cerr << format(_("Leaving repository %s unchanged.")) % alias << endl;
+
+ ERR << "Error while modifying the repository:" << ex.asUserString() << endl;
}
}
{
if (system ("pgrep -lx zmd") == 0)
{ // list name, exact match
- cerr << _("ZENworks Management Daemon is running.\n"
+ cout_n << _("ZENworks Management Daemon is running.\n"
"WARNING: this command will not synchronize changes.\n"
"Use rug or yast2 for that.\n");
+ USR << ("ZMD is running. Tell the user this will get"
+ " ZMD and libzypp out of sync.") << endl;
}
}
#include <boost/logic/tribool.hpp>
+#include <zypp/base/Logger.h>
#include <zypp/zypp_detail/ZYppReadOnlyHack.h>
#include "zypper.h"
static struct option global_options[] = {
{"help", no_argument, 0, 'h'},
{"verbose", no_argument, 0, 'v'},
+ {"silent", no_argument, 0, 'S'},
{"version", no_argument, 0, 'V'},
{"terse", no_argument, 0, 't'},
{"table-style", required_argument, 0, 's'},
string help_global_options = _(" Options:\n"
"\t--help, -h\t\tHelp\n"
"\t--version, -V\t\tOutput the version number\n"
+ "\t--silent, -S\t\tSuppress normal output\n"
"\t--verbose, -v\t\tIncrease verbosity\n"
"\t--terse, -t\t\tTerse output for machine consumption\n"
"\t--table-style, -s\tTable style (integer)\n"
"\t--non-interactive\tDon't ask anything, use default answers automatically. (under development)\n"
"\t--root, -R <dir>\tOperate on a different root directory\n");
;
+
+ if (gopts.count("silent")) {
+ gSettings.verbose = -1;
+ DBG << "Verbosity " << gSettings.verbose << endl;
+ }
if (gopts.count("verbose")) {
gSettings.verbose += gopts["verbose"].size();
- cerr << _("Verbosity ") << gSettings.verbose << endl;
+ cout << _("Verbosity ") << gSettings.verbose << endl;
+ DBG << _("Verbosity ") << gSettings.verbose << endl;
}
if (gopts.count("non-interactive")) {
gSettings.non_interactive = true;
- cout << "Entering non-interactive mode.\n"
+ cout_n << "Entering non-interactive mode.\n"
"WARNING: global non-interactive mode is still under development, use "
"with caution. This mode has been implemented and tested for install, "
"remove, and update commands so far. In case of problems related to "
// testing option
if (gopts.count("opt")) {
- cerr << "Opt arg: ";
+ cout << "Opt arg: ";
std::copy (gopts["opt"].begin(), gopts["opt"].end(),
- ostream_iterator<string> (cerr, ", "));
- cerr << endl;
+ ostream_iterator<string> (cout, ", "));
+ cout << endl;
}
// get command
// exception from command parsing
catch (Exception & e)
{
- cerr << e.msg() << endl;
+ cerr << e.msg() << endl;
command = ZypperCommand::NONE;
}
if (command == ZypperCommand::NONE)
{
if (ghelp)
- cerr << help_global_options << endl << help_commands;
+ cout << help_global_options << endl << help_commands;
else if (gopts.count("version"))
- cerr << PACKAGE << endl;
+ cout << PACKAGE << endl;
else
cerr << _("Try -h for help") << endl;
}
vector<string> arguments;
if (optind < argc) {
- cerr_v << _("Non-option program arguments: ");
+ cout_v << _("Non-option program arguments: ");
while (optind < argc) {
string argument = argv[optind++];
- cerr_v << argument << ' ';
+ cout_v << argument << ' ';
arguments.push_back (argument);
}
- cerr_v << endl;
+ cout_v << endl;
}
// === process options ===
if (gopts.count("terse")) {
- cerr_v << _("Ignoring --terse (provided only for rug compatibility)") << endl;
+ cout_v << _("Ignoring --terse (provided only for rug compatibility)") << endl;
+ WAR << "Ignoring --terse (provided only for rug compatibility)" << endl;
}
if (gopts.count("disable-system-sources"))
if (gopts.count("disable-system-resolvables"))
{
MIL << "System resolvables disabled" << endl;
- cerr << _("Ignoring installed resolvables...") << endl;
+ cout_v << _("Ignoring installed resolvables...") << endl;
gSettings.disable_system_resolvables = true;
}
{
if (ghelp) { cout << specific_help << endl; return !ghelp; }
- cout << " \\\\\\\\\\\n \\\\\\\\\\\\\\__o\n__\\\\\\\\\\\\\\'/_" << endl;
+ cout_n << " \\\\\\\\\\\n \\\\\\\\\\\\\\__o\n__\\\\\\\\\\\\\\'/_" << endl;
return ZYPPER_EXIT_OK;
}
string type = copts.count("type") ? copts["type"].front() : "";
// display help message if insufficient info was given
- if (ghelp || arguments.size() < 1)
+ if (ghelp || arguments.size() < 2)
{
- //! todo display_help()
- cerr << specific_help;
- if (ghelp) return ZYPPER_EXIT_OK;
- return ZYPPER_EXIT_ERR_INVALID_ARGS;
+ if (ghelp)
+ {
+ cout << specific_help;
+ return ZYPPER_EXIT_OK;
+ }
+ else
+ {
+ cerr << _("Too few arguments. At least URL and alias are required.") << endl;
+ ERR << "Too few arguments. At least URL and alias are required." << endl;
+ cout_n << specific_help;
+ return ZYPPER_EXIT_ERR_INVALID_ARGS;
+ }
}
Url url = make_url (arguments[0]);
else if (command == ZypperCommand::REMOVE_REPO)
{
- if (ghelp || arguments.size() < 1) {
- cerr << specific_help;
- return !ghelp;
+ if (ghelp || arguments.size() < 1)
+ {
+ if (ghelp)
+ {
+ cout << specific_help;
+ return ZYPPER_EXIT_OK;
+ }
+ else
+ {
+ cerr << _("Required argument missing.") << endl;
+ ERR << "Required argument missing." << endl;
+ cout_n << specific_help;
+ return ZYPPER_EXIT_ERR_INVALID_ARGS;
+ }
}
warn_if_zmd ();
else if (command == ZypperCommand::RENAME_REPO)
{
- if (ghelp || arguments.size() < 2) { cerr << specific_help; return !ghelp; }
+ if (ghelp || arguments.size() < 2)
+ {
+ if (ghelp)
+ {
+ cout << specific_help;
+ return ZYPPER_EXIT_OK;
+ }
+ else
+ {
+ cerr << _("Too few arguments. At least URL and alias are required.") << endl;
+ ERR << "Too few arguments. At least URL and alias are required." << endl;
+ cout_n << specific_help;
+ return ZYPPER_EXIT_ERR_INVALID_ARGS;
+ }
+ }
// cond_init_target ();
warn_if_zmd ();
ZyppSearchOptions options;
if (ghelp) {
- cerr << specific_help;
+ cout << specific_help;
return !ghelp;
}
search.doSearch(FillTable(t, search.installedCache()));
if (t.empty())
- cout << "No packages found." << endl;
+ cout_n << "No packages found." << endl;
else {
if (copts.count("sort-by-catalog")) t.sort(1);
else t.sort(3); // sort by name
// TODO: rug summary
else if (command == ZypperCommand::PATCH_CHECK) {
if (ghelp) {
- cerr << specific_help;
+ cout << specific_help;
return !ghelp;
}
else if (command == ZypperCommand::SHOW_PATCHES) {
if (ghelp) {
- cerr << specific_help;
+ cout << specific_help;
return !ghelp;
}
else if (command == ZypperCommand::LIST_UPDATES) {
if (ghelp) {
// FIXME catalog...
- cerr << specific_help;
+ cout << specific_help;
return !ghelp;
}
// -----------------------------( update )----------------------------------
else if (command == ZypperCommand::UPDATE) {
- if (ghelp) { cerr << specific_help; return !ghelp; }
+ if (ghelp) { cout << specific_help; return !ghelp; }
string skind = copts.count("type")? copts["type"].front() :
gSettings.is_rug_compatible? "package" : "patch";
#define ZYPPER_EXIT_INF_REBOOT_NEEDED 102 // reboot needed after install/upgrade
#define ZYPPER_EXIT_INF_RESTART_NEEDED 103 // restart of package manager itself needed
+/**
+ * Structure for holding various start-up setting.
+ */
struct Settings
{
Settings()
std::list<zypp::Url> additional_sources;
std::string previous_token;
+
+ /**
+ * Level of the amount of output.
+ *
+ * <ul>
+ * <li>-1 silent</li>
+ * <li> 0 normal (default)</li>
+ * <li> 1 verbose</li>
+ * <li> 2 debug</li>
+ * </ul>
+ */
int verbose;
int previous_code;
std::string command;
extern Settings gSettings;
extern std::ostream no_stream;
-#define COND_STREAM(STREAM,LEVEL) ((gSettings.verbose >= LEVEL)? STREAM: no_stream)
-#define cerr_v COND_STREAM(cerr,1)
-#define cout_v COND_STREAM(cout,1)
-#define cerr_vv COND_STREAM(cerr,2)
-#define cout_vv COND_STREAM(cout,2)
+/**
+ * Macro to filter output above the current verbosity level.
+ *
+ * \see Output Macros
+ * \see Settings::verbose
+ */
+#define COND_STREAM(STREAM,LEVEL) ((gSettings.verbose >= LEVEL) ? STREAM : no_stream)
+
+/** \name Output Macros
+ * Alway use these macros to produce output so that the verbosity options
+ * like -v or --silent are respected. Use standard cout and cerr only in
+ * cases where it is desirable to ignore them (e.g. help texts (when -h is
+ * used) or brief error messages must always be displayed, even if --silent
+ * has been specified).
+ */
+//!@{
+//! normal output
+#define cout_n COND_STREAM(cout, 0)
+//! verbose output
+#define cout_v COND_STREAM(cout, 1)
+//! verbose error output
+#define cerr_v COND_STREAM(cerr, 1)
+//! debug info output
+#define cout_vv COND_STREAM(cout, 2)
+//! debug error output (details)
+#define cerr_vv COND_STREAM(cerr, 2)
+//!@}
// undefine _ macro from libzypp
#ifdef _