1234567891011121314151617181920212223242526272829303132333435 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- """
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2024/06/22
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc : command line params or config from file
- """
- import sys,os,re
- import argparse
- from collections import OrderedDict
- def parse_args():
- parser = argparse.ArgumentParser(description='search domain')
- parser.add_argument('command', help='command: generate, search', choices=['generate','search', 'help','version'] , default='help')
- parser.add_argument('--export_all', action='store_true', help='export all domain')
- parser.add_argument('--lang', choices=['zh', 'en'], default='en',help='language')
- parser.add_argument('--keyword', default='',help='input a keyword')
- parser.add_argument('--positon', default='prefix',choices=['prefix', 'suffix'], help='choose generate str positon')
- args = parser.parse_args()
- # remove None
- command_line_conf = OrderedDict(
- {k: v for k, v in args.__dict__.items() if v is not None}
- )
- system_conf = user_conf = custom_conf = OrderedDict()
- system_conf.update(command_line_conf)
- return system_conf
- def _read_custom_conf(config_path: str) -> OrderedDict:
- pass
- def _read_user_conf() -> OrderedDict:
- pass
|