Skip to content

Commit 17d1fd8

Browse files
author
James TD Smith
committed
Add CLI options for highstate formatter modes
Support the --state-output and --state-verbose options for the highstate formatter. These allow selecting a more compact output format for states without changes or errors or hiding them entirely.
1 parent 8096e08 commit 17d1fd8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

pepper/cli.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ def parse(self):
108108
''')
109109
)
110110

111+
self.parser.add_option(
112+
'--state-output', dest='state_output', default="full", type="choice",
113+
choices = [ "full", "terse", "mixed", "changes", "filter" ],
114+
help=textwrap.dedent('''
115+
Output mode for highstate formatter
116+
''')
117+
)
118+
119+
self.parser.add_option(
120+
'--state-verbose', dest='state_verbose', default=None,
121+
help=textwrap.dedent('''
122+
Set to false to hide results with no changes
123+
''')
124+
)
125+
111126
self.parser.add_option(
112127
'--output-file', dest='output_file', default=None,
113128
help=textwrap.dedent('''

pepper/script.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def __init__(self):
3636
self.opts = {}
3737
if self.cli.options.output_file is not None:
3838
self.opts['output_file'] = self.cli.options.output_file
39+
if self.cli.options.state_output is not None:
40+
self.opts['state_output'] = self.cli.options.state_output
41+
if self.cli.options.state_verbose is not None:
42+
self.opts['state_verbose'] = self.cli.options.state_verbose in [ "true", "True", "1" ]
43+
3944

4045
@property
4146
def output(self):

0 commit comments

Comments
 (0)