|
@@ -16,11 +16,22 @@ def parse_args():
|
|
|
"""
|
|
|
parse command line params
|
|
|
"""
|
|
|
- parser = argparse.ArgumentParser(description='search domain')
|
|
|
+ parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description='''
|
|
|
+ crawl_sse
|
|
|
+ command line params:
|
|
|
+ python main.py crawl --extractor cninfo
|
|
|
+ python main.py download --extractor cninfo
|
|
|
+ python main.py crawl --extractor sse
|
|
|
+ ''', epilog="Believe that with the above description, " +
|
|
|
+ "you can start working right away. Wish you success")
|
|
|
+ # group = parser.add_mutually_exclusive_group()
|
|
|
parser.add_argument('command', help='command: crawl, download', choices=['crawl','download', 'help','version'] , default='help')
|
|
|
parser.add_argument('--extractor', help='extractor: cninfo, sse', choices=['cninfo','sse'], default='cninfo')
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
+ if args is None:
|
|
|
+ parser.print_help()
|
|
|
+ sys.exit(1)
|
|
|
# remove None
|
|
|
command_line_conf = OrderedDict(
|
|
|
{k: v for k, v in args.__dict__.items() if v is not None}
|