Skip to content

Commit

Permalink
Add CLI options for highstate formatter modes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
James TD Smith committed Jul 8, 2020
1 parent 8096e08 commit 17d1fd8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pepper/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ def parse(self):
''')
)

self.parser.add_option(
'--state-output', dest='state_output', default="full", type="choice",
choices = [ "full", "terse", "mixed", "changes", "filter" ],
help=textwrap.dedent('''
Output mode for highstate formatter
''')
)

self.parser.add_option(
'--state-verbose', dest='state_verbose', default=None,
help=textwrap.dedent('''
Set to false to hide results with no changes
''')
)

self.parser.add_option(
'--output-file', dest='output_file', default=None,
help=textwrap.dedent('''
Expand Down
5 changes: 5 additions & 0 deletions pepper/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def __init__(self):
self.opts = {}
if self.cli.options.output_file is not None:
self.opts['output_file'] = self.cli.options.output_file
if self.cli.options.state_output is not None:
self.opts['state_output'] = self.cli.options.state_output
if self.cli.options.state_verbose is not None:
self.opts['state_verbose'] = self.cli.options.state_verbose in [ "true", "True", "1" ]


@property
def output(self):
Expand Down

0 comments on commit 17d1fd8

Please sign in to comment.