From dd46733afd6615ad9280405205a791a2346d9fdd Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Sat, 30 Oct 2010 17:48:04 +0000 Subject: [PATCH] py-i2phosts-fetcher: add command-line options support --- py-i2phosts-fetcher | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/py-i2phosts-fetcher b/py-i2phosts-fetcher index 5d15625..8ea1619 100755 --- a/py-i2phosts-fetcher +++ b/py-i2phosts-fetcher @@ -8,6 +8,7 @@ import errno import time import urllib2 import subprocess +import argparse proxyurl = 'http://localhost:4444/' sources = ['http://www.i2p2.i2p/hosts.txt', 'http://stats.i2p/cgi-bin/newhosts.txt', @@ -18,6 +19,15 @@ sources = ['http://www.i2p2.i2p/hosts.txt', 'http://stats.i2p/cgi-bin/newhosts.t #sources = ['http://www.i2p2.i2p/hosts.txt', 'http://stats.i2p/cgi-bin/newhosts.txt'] #sources = ['http://hiddenchan.i2p/ggfg.txt'] #sources = ['http://stats.i2p/cgi-bin/newhosts.xml'] +# parse command line options +parser = argparse.ArgumentParser( + description='Hosts fetcher for py-i2phosts.', + epilog='Report bugs to http://zzz.i2p/topics/733') +parser.add_argument('-d', '--debug', action='store_true', + help='write debug messages to stdout instead of log file'), +parser.add_argument('-c', '--config', default='/etc/py-i2phosts/fetcher.conf', dest='config_file', + help='config file to use') +args = parser.parse_args() # we want open urls through proxy proxy_handler = urllib2.ProxyHandler({'http': proxyurl})