MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / main

Function main

archivebox/cli/archivebox_config.py:18–60  ·  view source on GitHub ↗
(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None)

Source from the content-addressed store, hash-verified

16
17@docstring(config.__doc__)
18def 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
63if __name__ == '__main__':

Callers 1

Calls 2

accept_stdinFunction · 0.85
configFunction · 0.85

Tested by

no test coverage detected