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:
parent
803bbef6c6
commit
9b88d61af5
4
injector
4
injector
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user