Skip to content

Commit 8c66d32

Browse files
committed
cleanup of yaml print output if yaml package isnt installed
1 parent 894ae11 commit 8c66d32

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cli4/cli4.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def cli4(args):
194194
elif opt in ('-j', '--json'):
195195
output = 'json'
196196
elif opt in ('-y', '--yaml'):
197+
if yaml is None:
198+
exit('cli4: install yaml support')
197199
output = 'yaml'
198200
elif opt in ('-r', '--raw'):
199201
raw = True
@@ -365,6 +367,6 @@ def cli4(args):
365367

366368
if output == 'json':
367369
print(json.dumps(results, indent=4, sort_keys=True))
368-
if output == 'yaml' and yaml is not None:
370+
if output == 'yaml':
369371
print(yaml.safe_dump(results))
370372

0 commit comments

Comments
 (0)