From 28a04f924079bd4d19ee4aa06102a2231f81669a Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Thu, 21 Oct 2010 18:36:54 +0000 Subject: [PATCH] py-i2phosts-injector: add -q/--quiet option With this option program should print only errors --- py-i2phosts-injector | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/py-i2phosts-injector b/py-i2phosts-injector index cf7deca..cc90e99 100755 --- a/py-i2phosts-injector +++ b/py-i2phosts-injector @@ -23,9 +23,14 @@ parser.add_argument('-f', '--file', default=os.environ['HOME'] + '/.i2p/hosts.tx parser.add_argument('-d', '--description', default='Auto-added from external hosts.txt', help='provide custom description message') parser.add_argument('-s', '--supress', action='store_true', - help='supress warnings about already existed hostnames') + help='supress warnings about already existed hostnames'), +parser.add_argument('-q', '--quiet', action='store_true', + help='be completely quiet, print only errors') args = parser.parse_args() +if args.quiet: + args.supress = True + f = open(args.hostsfile, 'r') for line in f: # ignore comments and empty lines @@ -50,7 +55,8 @@ for line in f: if not args.supress: print 'Host %s already exists' % hostname else: - print 'Adding %s' % hostname + if not args.quiet: + print 'Adding %s' % hostname host = i2phost(name=hostname, b64hash=base64, description=args.description, activated=True, external=True)