Skip to content

Commit e5b5d8e

Browse files
authored
Merge pull request #124 from planetlabs/output-report-persistence
Display report with asset locations for all CLI downloads
2 parents 47f2db5 + 57ed018 commit e5b5d8e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

planet/scripts/util.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ class _BaseOutput(object):
201201

202202
refresh_rate = 1
203203

204+
def _report_complete(self, item, asset, path=None):
205+
msg = {
206+
'item': item['id'],
207+
'asset': asset['type'],
208+
'location': path or asset['location']
209+
}
210+
# cancel() allows report log to persist for both ANSI & regular output
211+
self.cancel()
212+
click.echo(json.dumps(msg))
213+
204214
def __init__(self, thread, dl):
205215
self._thread = thread
206216
self._timer = None
@@ -231,14 +241,6 @@ def cancel(self):
231241

232242
class Output(_BaseOutput):
233243

234-
def _report_complete(self, item, asset, path=None):
235-
msg = {
236-
'item': item['id'],
237-
'asset': asset['type'],
238-
'location': path or asset['location']
239-
}
240-
click.echo(json.dumps(msg))
241-
242244
def _output(self, stats):
243245
logging.info('%s', stats)
244246

@@ -276,9 +278,6 @@ def _output(self, stats):
276278
self._stats.update(stats)
277279
self._do_output()
278280

279-
def _report_complete(self, item, asset, path=None):
280-
pass
281-
282281
def _do_output(self):
283282
# renders a terminal like:
284283
# highlighted status rows

0 commit comments

Comments
 (0)