Coverage for procpath/cli.py: 98%
128 statements
« prev ^ index » next coverage.py v6.5.0, created at 2025-04-05 18:56 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2025-04-05 18:56 +0000
1import argparse
2import logging
3import shutil
4import sys
5from datetime import datetime, timezone
7from . import __version__, cmd, procfile, procret
10logger = logging.getLogger(__package__)
13def add_query_parser(parent):
14 parser = parent.add_parser('query', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
15 Execute given JSONPath and/or SQL query against process tree producing JSON or
16 separator-delimited values.
17 ''')
18 parser.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
19 'query',
20 nargs='?',
21 help='''
22 JSONPath expression, for example this query returns
23 PIDs for process subtree including the given root's:
25 $..children[?(@.stat.pid == 2610)]..pid
26 '''
27 )
28 parser.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
29 'sql_query',
30 nargs='?',
31 help='''
32 SQL query to further filter and/or aggregate collected
33 process nodes. Note that if JSONPath query is present it must
34 return full nodes, e.g. $..children[?(@.stat.pid == 2610)].
35 For example this query returns total RSS of the processes:
37 SELECT SUM(stat_rss) / 1024.0 * 4 total FROM record
38 '''
39 )
40 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
41 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
42 '-f', '--procfile-list',
43 default='stat, cmdline',
44 type=lambda s: list(map(str.strip, s.split(','))),
45 help=f'''
46 Procfs files to read per PID. Comma-separated list. By default: %(default)s.
47 Available: {', '.join(procfile.registry.keys())}.
48 ''',
49 )
50 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
51 '-d', '--delimiter',
52 help='Join query result using given delimiter',
53 )
54 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
55 '-i', '--indent',
56 type=int,
57 help='Format result JSON using given indent number',
58 )
59 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
60 '-e', '--environment',
61 action='append',
62 type=lambda s: s.split('=', 1),
63 help='''
64 Commands to evaluate in the shell and template the queries, like VAR=date.
65 Multiple occurrence is possible.
66 ''',
67 )
68 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
69 '--procfs',
70 default='/proc',
71 type=lambda s: s.rstrip('/'),
72 help='Procfs mount path. By default: %(default)s.',
73 )
74 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
75 '--procfs-target',
76 default='process',
77 type={'process': 'process', 'thread': 'thread'}.__getitem__,
78 help='Procfs target object. By default: %(default)s. Available: process, thread.',
79 )
80 parser.set_defaults(output_file=sys.stdout) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
83def add_record_parser(parent):
84 parser = parent.add_parser('record', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
85 Record the nodes of process tree matching given JSONPath query into a SQLite
86 database in given intervals.
87 ''')
88 parser.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
89 'query',
90 nargs='?',
91 help='''
92 JSONPath expression, for example this query returns
93 a node including its subtree for given PID:
95 $..children[?(@.stat.pid == 2610)]
96 '''
97 )
98 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
99 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
100 '-f', '--procfile-list',
101 default='stat, cmdline',
102 type=lambda s: list(map(str.strip, s.split(','))),
103 help=f'''
104 Procfs files to read per PID. Comma-separated list. By default: %(default)s.
105 Available: {', '.join(procfile.registry.keys())}.
106 ''',
107 )
108 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
109 '-e', '--environment',
110 action='append',
111 type=lambda s: s.split('=', 1),
112 help='''
113 Commands to evaluate in the shell and template the query, like VAR=date.
114 Multiple occurrence is possible.
115 ''',
116 )
117 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
118 '-d', '--database-file',
119 required=True,
120 help='Path to the recording database file',
121 )
122 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
123 '-p', '--pid-list',
124 help='''
125 Keep only branches with given PIDs in the tree before running query
126 against it. Comma-separated list. It can include environment
127 variables.
128 ''',
129 )
130 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
131 '--procfs',
132 default='/proc',
133 type=lambda s: s.rstrip('/'),
134 help='Procfs mount path. By default: %(default)s.',
135 )
136 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
137 '--procfs-target',
138 default='process',
139 type={'process': 'process', 'thread': 'thread'}.__getitem__,
140 help='Procfs target object. By default: %(default)s. Available: process, thread.',
141 )
142 loop_control = parser.add_argument_group('loop control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
143 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
144 '-i', '--interval',
145 type=float,
146 default='10',
147 help='Interval in second between each recording, %(default)s by default.',
148 )
149 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
150 '-r', '--recnum',
151 type=int,
152 help='''
153 Number of recordings to take at --interval seconds apart.
154 If not specified, recordings will be taken indefinitely.
155 ''',
156 )
157 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
158 '-v', '--reevalnum',
159 type=int,
160 help='''
161 Number of recordings after which environment must be re-evaluate.
162 It's useful when you expect it to change while recordings are
163 taken.
164 ''',
165 )
166 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
167 '--stop-without-result',
168 action='store_true',
169 help='''
170 Prematurely stop recording when target processes can no longer be found,
171 or otherwise when the query and/or PID filter don't yield a result.
172 ''',
173 )
176def add_plot_parser(parent):
177 parser = parent.add_parser('plot', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
178 Plot previously recorded SQLite database using predefined or custom SQL
179 expression or query.
180 ''')
181 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
182 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
183 '-d', '--database-file',
184 required=True,
185 help='Path to the database file to read from.',
186 )
187 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
188 '-f', '--plot-file',
189 default='plot.svg',
190 help='Path to the output SVG file, plot.svg by default.',
191 )
192 query_control = parser.add_argument_group('query control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
193 query_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
194 '-q', '--query-name',
195 action='append',
196 dest='query_name_list',
197 help=f'''
198 Built-in query name. Available: {", ".join(procret.registry.keys())}.
199 Without --share-y-axis it can occur once or twice (including other
200 query-contributing options). In the latter case, the plot has two
201 Y axes.
202 ''',
203 )
204 query_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
205 '--custom-query-file',
206 action='append',
207 dest='custom_query_file_list',
208 help='''
209 Use custom SQL query in given file.
210 The result-set must have 3 columns: ts, pid, value. See procpath.procret.
211 Without --share-y-axis it can occur once or twice (including other
212 query-contributing options). In the latter case, the plot has two Y axes.
213 ''',
214 )
215 query_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
216 '--custom-value-expr',
217 action='append',
218 dest='custom_value_expr_list',
219 help='''
220 Use custom SELECT expression to plot as the value.
221 Without --share-y-axis it can occur once or twice (including other
222 query-contributing options). In the latter case, the plot has two Y axes.
223 ''',
224 )
225 filter_control = parser.add_argument_group('filter control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
226 filter_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
227 '-a', '--after',
228 type=lambda s: datetime.strptime(s, '%Y-%m-%dT%H:%M:%S').replace(tzinfo=timezone.utc),
229 help='Include only points after given UTC date, like 2000-01-01T00:00:00.',
230 )
231 filter_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
232 '-b', '--before',
233 type=lambda s: datetime.strptime(s, '%Y-%m-%dT%H:%M:%S').replace(tzinfo=timezone.utc),
234 help='Include only points before given UTC date, like 2000-01-01T00:00:00.',
235 )
236 filter_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
237 '-p', '--pid-list',
238 type=lambda s: list(map(int, s.split(','))),
239 help='Include only given PIDs. Comma-separated list.',
240 )
241 plot_control = parser.add_argument_group('plot control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
242 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
243 '-s', '--share-y-axis',
244 action='store_true',
245 help='Use the same Y axis for two or more queries.',
246 )
247 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
248 '-l', '--logarithmic',
249 action='store_true',
250 help='Plot using logarithmic scale.',
251 )
252 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
253 '--style',
254 help='Plot using given pygal.style, like LightGreenStyle.',
255 )
256 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
257 '--formatter',
258 help='Force given pygal.formatter, like integer.',
259 )
260 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
261 '--title',
262 help='Override plot title.',
263 )
264 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
265 '--no-dots',
266 action='store_true',
267 help='Do not add hover dots to the lines.',
268 )
269 plot_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
270 '--relative-time',
271 action='store_true',
272 help='Display X axis as time deltas since the first measurement.',
273 )
274 postprocessing_control = parser.add_argument_group('post-processing control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
275 postprocessing_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
276 '-e', '--epsilon',
277 type=float,
278 help='Reduce points using Ramer-Douglas-Peucker algorithm and given ε.',
279 )
280 postprocessing_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
281 '-w', '--moving-average-window',
282 type=int,
283 help='Smooth the lines using moving average.',
284 )
287def add_watch_parser(parent):
288 parser = parent.add_parser('watch', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
289 Execute given commands in given intervals. It has similar purpose to
290 procps watch, but allows JSONPath queries to the process tree to choose
291 processes of interest.
293 In each next process' environment exist variables WSP1, WSP2 and so on
294 containing PIDs of previous shells that run watched processes.
295 ''')
296 cmd_control = parser.add_argument_group('command control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
297 cmd_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
298 '-e', '--environment',
299 action='append',
300 type=lambda s: s.split('=', 1),
301 help='''
302 Commands to evaluate in the shell, like
303 C1='docker inspect -f "{{.State.Pid}}" nginx' or D='date +%%s'.
304 Multiple occurrence is possible.
305 ''',
306 )
307 cmd_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
308 '-q', '--query',
309 action='append',
310 dest='query_list',
311 type=lambda s: s.split('=', 1),
312 help='''
313 JSONPath expressions that typically evaluate into a list of PIDs.
314 The environment defined with -e can be used like
315 L1='$..children[?(@.stat.pid == $C1)]..pid'.
316 Multiple occurrence is possible.
317 ''',
318 )
319 cmd_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
320 '-c', '--command',
321 required=True,
322 dest='command_list',
323 action='append',
324 help='''
325 Target command to "watch" in the shell. The environment and query
326 results can be used like 'smemstat -o smemstat-$D.json -p $L1'.
327 Query result lists are joined with comma. Multiple occurrence is
328 possible.
329 ''',
330 )
331 loop_control = parser.add_argument_group('loop control arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
332 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
333 '-i', '--interval',
334 required=True,
335 type=float,
336 help='''
337 Interval in second after which to re-evaluate the environment and the
338 queries, and re-run each command if one has finished.
339 ''',
340 )
341 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
342 '-r', '--repeat',
343 type=int,
344 help='Fixed number of iterations instead of infinite watch.',
345 )
346 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
347 '--no-restart',
348 action='store_true',
349 help='''
350 Do not restart watched processes when they stop, and stop watching once no
351 watched process is running.
352 ''',
353 )
354 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
355 '-s', '--stop-signal',
356 default='SIGINT',
357 help='Signal to send to the spawned processes on watch stop. By default: %(default)s.',
358 )
359 loop_control.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
360 '--kill-after',
361 type=float,
362 default='10',
363 help='''
364 Kill all remaining descendant processes after this many seconds after the stop signal
365 has been sent. By default: %(default)s.',
366 ''',
367 )
368 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
369 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
370 '-f', '--procfile-list',
371 default='stat, cmdline',
372 type=lambda s: list(map(str.strip, s.split(','))),
373 help=f'''
374 Procfs files to read per PID. Comma-separated list. By default: %(default)s.
375 Available: {', '.join(procfile.registry.keys())}.
376 ''',
377 )
378 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
379 '--procfs',
380 default='/proc',
381 type=lambda s: s.rstrip('/'),
382 help='Procfs mount path. By default: %(default)s.',
383 )
384 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
385 '--procfs-target',
386 default='process',
387 type={'process': 'process', 'thread': 'thread'}.__getitem__,
388 help='Procfs target object. By default: %(default)s. Available: process, thread.',
389 )
392def add_play_parser(parent):
393 parser = parent.add_parser('play', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
394 Play one or more sections from given playbook.
395 ''')
396 parser.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
397 'target',
398 nargs='+',
399 help='''Name or glob-expression of the section from the playbook.'''
400 )
401 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
402 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
403 '-f', '--playbook-file',
404 required=True,
405 help='Path to the playbook to play.',
406 )
407 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
408 '-l', '--list-sections',
409 action='store_true',
410 help='List matching sections in the playbook.',
411 )
412 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
413 '-n', '--dry-run',
414 action='store_true',
415 help='Collect and print target sections.',
416 )
417 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
418 '-o', '--option',
419 action='append',
420 dest='option_override_list',
421 type=lambda s: s.split('=', 1),
422 help='''
423 A key-value pair to override the option in the playbook, like
424 database_file=db.sqlite. Multiple occurrence is possible.
425 ''',
426 )
427 parser.set_defaults(output_file=sys.stdout) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
430def add_explore_parser(parent):
431 parser = parent.add_parser('explore', formatter_class=HelpFormatter, description=''' (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
432 Serve a Sqliteviz build from a local web-server for exploratory or
433 ad-hoc visualisation.
435 On first invocation Sqliteviz is downloaded and saved locally for
436 later offline use. Procpath exports pre-defined queries into Sqliteviz.
437 ''')
438 arguments = parser.add_argument_group('named arguments') (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
439 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
440 '--reinstall',
441 action='store_true',
442 help='Remove local copy and fetch Sqliteviz build again.',
443 )
444 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
445 '--build-url',
446 default='https://github.com/lana-k/sqliteviz/releases/latest/download/dist.zip',
447 help='Sqliteviz build URL. By default: %(default)s.',
448 )
449 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
450 '-b', '--bind',
451 default='',
452 metavar='ADDRESS',
453 help='Specify alternate bind address. By default: all interfaces.',
454 )
455 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
456 '-p', '--port',
457 default=8000,
458 type=int,
459 help='Specify alternate port. By default: %(default)s.',
460 )
461 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
462 '--no-browser',
463 dest='open_in_browser',
464 action='store_false',
465 help='Do not open a browser after startup.',
466 )
467 arguments.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
468 '-d', '--database-file',
469 help='Database file to pre-load into Sqliteviz.',
470 )
473class HelpFormatter(argparse.HelpFormatter):
475 def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):
476 if not width: 476 ↛ 479line 476 didn't jump to line 479, because the condition on line 476 was never false(empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
477 width = min(100, shutil.get_terminal_size((80, 20)).columns) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
479 super().__init__(prog, indent_increment, max_help_position, width) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
481 def _format_usage(self, usage, actions, groups, prefix):
482 banner = ( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
483 r' ___ ___ ___ __ ___ __ _____ _ ''\n'
484 r' | |_) | |_) / / \ / /` | |_) / /\ | | | |_|''\n'
485 r' |_| |_| \ \_\_/ \_\_, |_| /_/--\ |_| |_| |''\n\n'
486 r' a process tree analysis workbench''\n'
487 )
488 result = super()._format_usage(usage, actions, groups, prefix) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
489 if actions: (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
490 result = '{}\n{}'.format(banner, result)
492 return result (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
494 def _get_default_metavar_for_optional(self, action):
495 return action.option_strings[-1].strip('-').upper()
498def build_parser(*, cls=argparse.ArgumentParser):
499 parser = cls(formatter_class=HelpFormatter) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
500 parser.add_argument('--version', action='version', version=__version__) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
501 parser.add_argument( (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
502 '--logging-level',
503 help='Logging level. By default: %(default)s.',
504 default='INFO',
505 )
507 cmd_funcs = [ (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
508 add_query_parser,
509 add_record_parser,
510 add_plot_parser,
511 add_explore_parser,
512 add_watch_parser,
513 add_play_parser,
514 ]
515 parent = parser.add_subparsers(dest='command', required=True) (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
516 [fn(parent) for fn in cmd_funcs] (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
518 return parser (empty)procpath.test.cmd.TestPlayCommand.test_get_special_argsprocpath.test.cmd.TestPlayCommand.test_play_all_mockedprocpath.test.cmd.TestPlayCommand.test_play_dry_runprocpath.test.cmd.TestPlayCommand.test_play_explicit_extendsprocpath.test.cmd.TestPlayCommand.test_play_missing_argumentsprocpath.test.cmd.TestPlayCommand.test_play_negative_flagprocpath.test.cmd.TestPlayCommand.test_play_plot_flag_args_alignedprocpath.test.cmd.TestPlayCommand.test_play_queryprocpath.test.cmd.TestPlayCommand.test_play_record_plotprocpath.test.cmd.TestPlayCommand.test_play_section_inheritanceprocpath.test.cmd.TestPlayCommand.test_play_unrecognised_argumentsprocpath.test.cmd.TestPlayCommand.test_play_watchprocpath.test.cmd.TestPlayCommand.test_play_watch_overrideprocpath.test.unit.TestCli.test_build_parser_exploreprocpath.test.unit.TestCli.test_build_parser_playprocpath.test.unit.TestCli.test_build_parser_plotprocpath.test.unit.TestCli.test_build_parser_queryprocpath.test.unit.TestCli.test_build_parser_recordprocpath.test.unit.TestCli.test_build_parser_watch
521def is_not_jsonpyth_debug_noise(record: logging.LogRecord) -> bool:
522 is_jsonpyth_debug_noise = (
523 record.module == 'jsonpyth'
524 and record.levelno == logging.DEBUG
525 and record.name == 'root'
526 )
527 return not is_jsonpyth_debug_noise
530def main():
531 logging.basicConfig(
532 level=logging.INFO,
533 format='%(asctime)s %(levelname)-7s %(name)s %(message)s',
534 datefmt='%Y-%m-%d %H:%M:%S',
535 )
536 logging.getLogger().addFilter(is_not_jsonpyth_debug_noise)
538 kwargs = vars(build_parser().parse_args())
539 logging.root.setLevel(kwargs.pop('logging_level'))
540 try:
541 cmd.get_command(kwargs.pop('command'))(**kwargs)
542 except KeyboardInterrupt: 542 ↛ 543line 542 didn't jump to line 543, because the exception caught by line 542 didn't happen
543 pass
544 except cmd.CommandError as ex:
545 logger.error(ex)
546 sys.exit(1)