MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / add_parsers

Function add_parsers

pre_commit/commands/hazmat.py:10–27  ·  view source on GitHub ↗
(parser: argparse.ArgumentParser)

Source from the content-addressed store, hash-verified

8
9
10def add_parsers(parser: argparse.ArgumentParser) -> None:
11 subparsers = parser.add_subparsers(dest='tool')
12
13 cd_parser = subparsers.add_parser(
14 'cd', help='cd to a subdir and run the command',
15 )
16 cd_parser.add_argument('subdir')
17 cd_parser.add_argument('cmd', nargs=argparse.REMAINDER)
18
19 ignore_exit_code_parser = subparsers.add_parser(
20 'ignore-exit-code', help='run the command but ignore the exit code',
21 )
22 ignore_exit_code_parser.add_argument('cmd', nargs=argparse.REMAINDER)
23
24 n1_parser = subparsers.add_parser(
25 'n1', help='run the command once per filename',
26 )
27 n1_parser.add_argument('cmd', nargs=argparse.REMAINDER)
28
29
30def _cmd_filenames(cmd: tuple[str, ...]) -> tuple[

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected