1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 12:34:17 +00:00

injector: add command-line option for description

This commit is contained in:
Hidden Z 2010-10-18 20:13:04 +00:00
parent 803bbef6c6
commit 9b88d61af5

View File

@ -20,6 +20,8 @@ parser = argparse.ArgumentParser(
epilog='Report bugs to http://zzz.i2p/topics/733')
parser.add_argument('-f', '--file', default=os.environ['HOME'] + '/.i2p/hosts.txt', dest='hostsfile',
help='hosts.txt for parsing')
parser.add_argument('-d', '--description', default='Auto-added from external hosts.txt',
help='provide custom description message')
args = parser.parse_args()
f = open(args.hostsfile, 'r')
@ -47,7 +49,7 @@ for line in f:
else:
print 'Adding %s' % hostname
host = i2phost(name=hostname, b64hash=base64,
description='Auto-added from external hosts.txt',
description=args.description,
activated=True, external=True)
host.save()
f.close()