From 17d1fd85938b45a52450c80624a59b8e94ad29a7 Mon Sep 17 00:00:00 2001 From: James TD Smith Date: Wed, 8 Jul 2020 17:31:46 +0100 Subject: [PATCH 1/2] 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. --- pepper/cli.py | 15 +++++++++++++++ pepper/script.py | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/pepper/cli.py b/pepper/cli.py index 68901d9..2048203 100644 --- a/pepper/cli.py +++ b/pepper/cli.py @@ -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(''' diff --git a/pepper/script.py b/pepper/script.py index 21afe63..a261f19 100755 --- a/pepper/script.py +++ b/pepper/script.py @@ -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): From dea4bc3102adbba8d85b4fb4bdafd152962d8990 Mon Sep 17 00:00:00 2001 From: James TD Smith Date: Thu, 20 Apr 2023 21:26:01 +0100 Subject: [PATCH 2/2] Update pepper/cli.py Add *_id output options as suggested by @eliasp Co-authored-by: Elias Probst --- pepper/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pepper/cli.py b/pepper/cli.py index 2048203..cd26dfb 100644 --- a/pepper/cli.py +++ b/pepper/cli.py @@ -110,7 +110,7 @@ def parse(self): self.parser.add_option( '--state-output', dest='state_output', default="full", type="choice", - choices = [ "full", "terse", "mixed", "changes", "filter" ], + choices = [ "full", "full_id", "terse", "terse_id", "mixed", "mixed_id", "changes", "changes_id", "filter", "filter_id" ], help=textwrap.dedent(''' Output mode for highstate formatter ''')