From 4b3a11f77543c6a56972e076c547d1a181fbe577 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 30 Oct 2014 23:03:39 +0100 Subject: [PATCH] nicer cli list output --- client/cli/bam | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/cli/bam b/client/cli/bam index 5b63d0b..5a5e92c 100755 --- a/client/cli/bam +++ b/client/cli/bam @@ -46,7 +46,6 @@ class bam_utils: # TODO, get from config BAM_SERVER = "http://localhost:5000" result = "%s/%s" % (BAM_SERVER, req_path) - print(result) return result @staticmethod @@ -110,10 +109,14 @@ class bam_utils: stream=True, ) - for chunk in r.iter_content(chunk_size=1024): - if chunk: # filter out keep-alive new chunks - sys.stdout.write(chunk.decode('utf-8')) - sys.stdout.flush() + items = r.json().get("items_list", ()) + + for (name_short, name_full, file_type) in items: + if file_type == "dir": + print(" %s/" % name_short) + for (name_short, name_full, file_type) in items: + if file_type != "dir": + print(" %s" % name_short) def subcommand_checkout_cb(args): bam_utils.checkout(args.paths)