fix the setting of the quiet option properly this time
authorBrian Dolbec <brian.dolbec@gmail.com>
Tue, 25 Jan 2011 17:00:31 +0000 (09:00 -0800)
committerBrian Dolbec <brian.dolbec@gmail.com>
Tue, 25 Jan 2011 17:00:31 +0000 (09:00 -0800)
pym/gentoolkit/analyse/analyse.py
pym/gentoolkit/analyse/base.py

index 7e47724067a304d68a35200100647b83b6fa5c4a..275bbc093b24a8c9c31280b044060460eb8ef360 100644 (file)
@@ -242,6 +242,7 @@ class Analyse(ModuleBase):
                """
                query = self.main_setup(input_args)
                query = self.validate_query(query)
+               self.set_quiet(quiet)
                if query in ["use", "pkguse"]:
                        self.analyse_flags(query)
                elif query in ["keywords"]:
index 8fe38db3d76635e5b122b296ba60b7d29deef4e3..a3f3feda521f04272759f744242d3282ce2e7039 100644 (file)
@@ -36,6 +36,7 @@ class ModuleBase(object):
                self.module_opts = {}
                self.warning = None
                self.need_queries = True
+               self.saved_verbose = None
 
 
        def print_help(self, with_description=True):
@@ -87,9 +88,21 @@ class ModuleBase(object):
                                        self.print_help(with_description=False)
                                        sys.exit(2)
                                self.options[opt_name] = val
-               self.options['quiet'] = CONFIG["quiet"]
-               if self.options['quiet']:
+
+       def set_quiet(self, quiet):
+               """sets the class option["quiet"] and option["verbose"] accordingly"""
+               if quiet == self.options['quiet']:
+                       return
+               if self.saved_verbose:
+                       # detected a switch
+                       verbose = self.options['verbose'] 
+                       self.options['verbose']  = self.saved_verbose
+                       self.saved_verbose = verbose
+               elif quiet:
+                       self.saved_verbose = self.options['verbose'] 
                        self.options['verbose'] = False
+               self.options['quiet'] = quiet
+               return
 
        def validate_query(self, query, depth=0):
                """check that the query meets the modules TargetSpec