Skip to content

Commit e168f07

Browse files
fmoessbauerjan-kiszka
authored andcommitted
refactor: move parser formatting args to function
As a preparation to separate the lock file generation logic from the dump plugin, we move the setup of the output formatting parser options to a function. By that, this function can later be included in other plugins. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
1 parent 8a55e59 commit e168f07

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kas/plugins/dump.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,22 @@ def represent_data(self, data):
154154
return self.represent_scalar('tag:yaml.org,2002:null', '')
155155
return super().represent_data(data)
156156

157+
@staticmethod
158+
def setup_parser_format_args(parser):
159+
parser.add_argument('--indent',
160+
type=int,
161+
default=4,
162+
help='Line indent (# of spaces, default: 4)')
163+
157164
@classmethod
158165
def setup_parser(cls, parser):
159166
super().setup_parser(parser)
167+
Dump.setup_parser_format_args(parser)
160168
lk_or_env = parser.add_mutually_exclusive_group()
161169
parser.add_argument('--format',
162170
choices=['yaml', 'json'],
163171
default='yaml',
164172
help='Output format (default: yaml)')
165-
parser.add_argument('--indent',
166-
type=int,
167-
default=4,
168-
help='Line indent (# of spaces, default: 4)')
169173
parser.add_argument('--resolve-refs',
170174
action='store_true',
171175
help='Replace floating refs with exact SHAs')

0 commit comments

Comments
 (0)