]> git.llucax.com Git - software/subdivxget.git/commitdiff
Add --quiet option
authorLeandro Lucarella <luca@llucax.com.ar>
Sat, 14 Jul 2012 18:17:35 +0000 (20:17 +0200)
committerLeandro Lucarella <luca@llucax.com.ar>
Sat, 14 Jul 2012 18:17:35 +0000 (20:17 +0200)
subdivxget

index 597110cbcb820cd0dc1d3d53fb25358eeda502ed..b985e27023e008588d1cab772781361d8d8cd7ff 100755 (executable)
@@ -23,6 +23,9 @@ def output(fo, fmt, *args, **kargs):
        fo.write((fmt % args) + '\n')
 
 def echo(fmt, *args, **kargs):
+       global opts
+       if opts.quiet:
+               return
        output(sys.stdout, fmt, *args, **kargs)
 
 def error(fmt, *args, **kargs):
@@ -278,11 +281,18 @@ looked in all the fields.
        parser.add_option("-l", "--list-only",
                        default=False, action='store_true',
                        help="Don't download the subtitles, just list them")
+       parser.add_option("-q", "--quiet",
+                       default=False, action='store_true',
+                       help="Don't print progress messages")
 
        (opts, args) = parser.parse_args()
        if not args:
               parser.error("Missing query string")
 
+       if opts.quiet and opts.list_only:
+               parser.error("Using --quiet and --list-only together doesn't "
+                               "make any sense")
+
        return (args[0], args[1:], opts)
 
 (query_str, filters, opts) = parse_args(sys.argv)