Skip to content

Commit

Permalink
cleanup of yaml print output if yaml package isnt installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Dec 10, 2016
1 parent 894ae11 commit 8c66d32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli4/cli4.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def cli4(args):
elif opt in ('-j', '--json'):
output = 'json'
elif opt in ('-y', '--yaml'):
if yaml is None:
exit('cli4: install yaml support')
output = 'yaml'
elif opt in ('-r', '--raw'):
raw = True
Expand Down Expand Up @@ -365,6 +367,6 @@ def cli4(args):

if output == 'json':
print(json.dumps(results, indent=4, sort_keys=True))
if output == 'yaml' and yaml is not None:
if output == 'yaml':
print(yaml.safe_dump(results))

0 comments on commit 8c66d32

Please sign in to comment.