Skip to content

Commit de9cb70

Browse files
committed
fix: handling for overwrite class without json output
1 parent cc03184 commit de9cb70

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

seqerakit/cli.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ def __init__(self, sp, list_for_add_method):
110110
"""
111111
self.sp = sp
112112
self.list_for_add_method = list_for_add_method
113-
# Create an instance of Overwrite class
114-
self.overwrite_method = overwrite.Overwrite(self.sp)
113+
114+
# Create a separate instance of the Overwrite class without JSON output
115+
sp_without_json = seqeraplatform.SeqeraPlatform(
116+
cli_args=sp.cli_args,
117+
dryrun=sp.dryrun,
118+
json=False,
119+
)
120+
self.overwrite_method = overwrite.Overwrite(sp_without_json)
115121

116122
def handle_block(self, block, args, destroy=False, dryrun=False):
117123
# Check if delete is set to True, and call delete handler

seqerakit/seqeraplatform.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ def _execute_command(self, full_cmd, to_json=False, print_stdout=True):
139139

140140
if self.json or to_json:
141141
out = json.loads(stdout)
142-
print(json.dumps(out))
142+
if should_print:
143+
print(json.dumps(out))
143144
else:
144145
out = stdout
145-
print(stdout)
146+
if should_print:
147+
print(stdout)
146148

147149
return out
148150

0 commit comments

Comments
 (0)