mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Add --quiet option.
This is need, e.g., to suppress logging message for 'exists'. TBR=agable@chromium.org,hinoka@chromium.org BUG= Review URL: https://codereview.chromium.org/299163002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@272450 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
12
git_cache.py
12
git_cache.py
@@ -496,11 +496,18 @@ class OptionParser(optparse.OptionParser):
|
||||
optparse.OptionParser.__init__(self, *args, prog='git cache', **kwargs)
|
||||
self.add_option('-c', '--cache-dir',
|
||||
help='Path to the directory containing the cache')
|
||||
self.add_option('-v', '--verbose', action='count', default=0,
|
||||
self.add_option('-v', '--verbose', action='count', default=1,
|
||||
help='Increase verbosity (can be passed multiple times)')
|
||||
self.add_option('-q', '--quiet', action='store_true',
|
||||
help='Suppress all extraneous output')
|
||||
|
||||
def parse_args(self, args=None, values=None):
|
||||
options, args = optparse.OptionParser.parse_args(self, args, values)
|
||||
if options.quiet:
|
||||
options.verbose = 0
|
||||
|
||||
levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
|
||||
logging.basicConfig(level=levels[min(options.verbose, len(levels) - 1)])
|
||||
|
||||
try:
|
||||
global_cache_dir = Mirror.GetCachePath()
|
||||
@@ -513,9 +520,6 @@ class OptionParser(optparse.OptionParser):
|
||||
logging.warn('Overriding globally-configured cache directory.')
|
||||
Mirror.SetCachePath(options.cache_dir)
|
||||
|
||||
levels = [logging.WARNING, logging.INFO, logging.DEBUG]
|
||||
logging.basicConfig(level=levels[min(options.verbose, len(levels) - 1)])
|
||||
|
||||
return options, args
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user