Browse Source

py-i2phosts-injector: add -q/--quiet option

With this option program should print only errors
pull/1/head
Hidden Z 14 years ago
parent
commit
28a04f9240
  1. 8
      py-i2phosts-injector

8
py-i2phosts-injector

@ -23,9 +23,14 @@ parser.add_argument('-f', '--file', default=os.environ['HOME'] + '/.i2p/hosts.tx @@ -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,6 +55,7 @@ for line in f: @@ -50,6 +55,7 @@ for line in f:
if not args.supress:
print 'Host %s already exists' % hostname
else:
if not args.quiet:
print 'Adding %s' % hostname
host = i2phost(name=hostname, b64hash=base64,
description=args.description,

Loading…
Cancel
Save