Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 9b31b51

Browse files
committed
--quite options yields TypeError - fixed!
1 parent 1e356dc commit 9b31b51

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

cli4/cli4.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def run_command(cf, method, command, params=None, content=None, files=None):
166166
def write_results(results, output):
167167
"""dump the results"""
168168

169+
if output is None:
170+
return
171+
169172
if len(results) == 1:
170173
results = results[0]
171174

@@ -175,6 +178,8 @@ def write_results(results, output):
175178
pass
176179
else:
177180
# anything more complex (dict, list, etc) should be dumped as JSON/YAML
181+
if output is None:
182+
results = None
178183
if output == 'json':
179184
try:
180185
results = json.dumps(results,
@@ -196,9 +201,10 @@ def write_results(results, output):
196201
writer.close()
197202
return
198203

199-
sys.stdout.write(results)
200-
if not results.endswith('\n'):
201-
sys.stdout.write('\n')
204+
if results:
205+
sys.stdout.write(results)
206+
if not results.endswith('\n'):
207+
sys.stdout.write('\n')
202208

203209
def do_it(args):
204210
"""Cloudflare API via command line"""

0 commit comments

Comments
 (0)