# HG changeset patch # User brett # Date 1166574434 18000 # Node ID 0a3ef1b9f6d4244a9b323f33df992cf931894acd # Parent 5d202467c5891d8fdb9f476759729982d917b185 [svn] Add options to tweak the logging level to taste. diff -r 5d202467c589 -r 0a3ef1b9f6d4 TODO --- a/TODO Tue Dec 19 19:13:29 2006 -0500 +++ b/TODO Tue Dec 19 19:27:14 2006 -0500 @@ -1,14 +1,14 @@ Things which I have a use case/anti-use case for: +* Avoid overwriting directories. * Decompress non-archive files. -* Figure out what to do about warnings in the Handlers. +* Better error messages (file doesn't exist, isn't readable, etc.) +* Interactivity: ask about overwriting, recursing, etc. Things that are generally good: * Better tests. * Better error messages. Things I think might be good but can't prove: -* Interactivity ("This archive contains other archive files. Would you - like to extract them as well?") * Consider having options about whether or not to make sane directories, have tarbomb protection, etc. * Use zipfile instead of the zip commands. diff -r 5d202467c589 -r 0a3ef1b9f6d4 scripts/x --- a/scripts/x Tue Dec 19 19:13:29 2006 -0500 +++ b/scripts/x Tue Dec 19 19:27:14 2006 -0500 @@ -332,6 +332,12 @@ parser.add_option('-r', '--recursive', dest='recursive', action='store_true', default=False, help='extract archives contained in the ones listed') + parser.add_option('-q', '--quiet', dest='quiet', + action='count', default=3, + help='suppress warning/error messages') + parser.add_option('-v', '--verbose', dest='verbose', + action='count', default=0, + help='be verbose/print debugging information') self.options, filenames = parser.parse_args(arguments) if not filenames: parser.error("you did not list any archives") @@ -340,8 +346,8 @@ def setup_logger(self): self.logger = logging.getLogger('x-log') handler = logging.StreamHandler() - # Switch here. - handler.setLevel(logging.WARNING) + # WARNING is the default. + handler.setLevel(10 * (self.options.quiet - self.options.verbose)) formatter = logging.Formatter("x: %(levelname)s: %(message)s") handler.setFormatter(formatter) self.logger.addHandler(handler)