From 4a2fcf2e50ae4a3ef5c0f5b871f475f5ef5f5911 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 25 Mar 2013 17:24:51 +0000 Subject: Rename --silent to --quiet 'silent' is a poort name for an option that admits to not being silent: --silent Only display FATAL errors on stdout Rename the option to '--quiet' instead and document it in the man page. It's probably also worth either documenting the fact that UI text is still printed when --quiet is given in non-batch mode or changing interactive mode to only print essential prompts when run with --quiet. Signed-off-by: Bryn M. Reeves --- man/en/sosreport.1 | 3 +++ sos/policies/__init__.py | 6 +++--- sos/sosreport.py | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/man/en/sosreport.1 b/man/en/sosreport.1 index e28e7581..9f47f3c7 100644 --- a/man/en/sosreport.1 +++ b/man/en/sosreport.1 @@ -45,6 +45,9 @@ Upload the report to Red Hat (use exclusively if advised from a Red Hat support .B \-v, \--verbose Increase the verbosity of the output as sosreport is running. Multiple -v mean more verbosity. .TP +.B \-q, \--quiet +Only log fatal errors to stderr. +.TP .B \--report Enable html/xml report writing .TP diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index a82aa7b8..7e2d3375 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -339,8 +339,8 @@ No changes will be made to system configuration. def _print(self, msg=None): """A wrapper around print that only prints if we are not running in - silent mode""" - if not self.commons['cmdlineopts'].silent: + quiet mode""" + if not self.commons['cmdlineopts'].quiet: if msg: print msg else: @@ -430,7 +430,7 @@ class LinuxPolicy(Policy): localname = self.getLocalName() - if not self.commons['cmdlineopts'].batch and not self.commons['cmdlineopts'].silent: + if not self.commons['cmdlineopts'].batch and not self.commons['cmdlineopts'].quiet: try: self.reportName = raw_input(_("Please enter your first initial and last name [%s]: ") % localname) diff --git a/sos/sosreport.py b/sos/sosreport.py index ef49a09c..c32f7d0b 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -322,7 +322,7 @@ class SoSReport(object): flog.setLevel(logging.INFO) self.soslog.addHandler(flog) - if not self.opts.silent: + if not self.opts.quiet: console = logging.StreamHandler(sys.stderr) console.setFormatter(logging.Formatter('%(message)s')) if self.opts.verbosity > 1: @@ -344,7 +344,7 @@ class SoSReport(object): self.ui_log.addHandler(ui_fhandler) - if not self.opts.silent: + if not self.opts.quiet: ui_console = logging.StreamHandler(sys.stdout) ui_console.setFormatter(logging.Formatter('%(message)s')) ui_console.setLevel(logging.INFO) @@ -641,7 +641,7 @@ class SoSReport(object): for i in izip(self.loaded_plugins): plugruncount += 1 plugname, plug = i[0] - if not self.opts.silent: + if not self.opts.quiet: sys.stdout.write("\r Running %d/%d: %s... " % (plugruncount, len(self.loaded_plugins), plugname)) sys.stdout.flush() try: @@ -822,8 +822,8 @@ class SoSReport(object): parser.add_option("-v", "--verbose", action="count", dest="verbosity", help="increase verbosity") - parser.add_option("", "--silent", action="store_true", - dest="silent", default=False, + parser.add_option("", "--quiet", action="store_true", + dest="quiet", default=False, help="Only display FATAL errors on stdout") parser.add_option("--debug", action="count", dest="debug", -- cgit