(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None)
| 16 | |
| 17 | @docstring(config.__doc__) |
| 18 | def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None) -> None: |
| 19 | parser = argparse.ArgumentParser( |
| 20 | prog=__command__, |
| 21 | description=config.__doc__, |
| 22 | add_help=True, |
| 23 | formatter_class=SmartFormatter, |
| 24 | ) |
| 25 | group = parser.add_mutually_exclusive_group() |
| 26 | group.add_argument( |
| 27 | '--get', #'-g', |
| 28 | action='store_true', |
| 29 | help="Get the value for the given config KEYs", |
| 30 | ) |
| 31 | group.add_argument( |
| 32 | '--set', #'-s', |
| 33 | action='store_true', |
| 34 | help="Set the given KEY=VALUE config values", |
| 35 | ) |
| 36 | group.add_argument( |
| 37 | '--reset', #'-s', |
| 38 | action='store_true', |
| 39 | help="Reset the given KEY config values to their defaults", |
| 40 | ) |
| 41 | parser.add_argument( |
| 42 | 'config_options', |
| 43 | nargs='*', |
| 44 | type=str, |
| 45 | help='KEY or KEY=VALUE formatted config values to get or set', |
| 46 | ) |
| 47 | command = parser.parse_args(args or ()) |
| 48 | |
| 49 | config_options_str = '' |
| 50 | if not command.config_options: |
| 51 | config_options_str = accept_stdin(stdin) |
| 52 | |
| 53 | config( |
| 54 | config_options_str=config_options_str, |
| 55 | config_options=command.config_options, |
| 56 | get=command.get, |
| 57 | set=command.set, |
| 58 | reset=command.reset, |
| 59 | out_dir=pwd or OUTPUT_DIR, |
| 60 | ) |
| 61 | |
| 62 | |
| 63 | if __name__ == '__main__': |
no test coverage detected