From 9cbd705421591c0ea1e1e16afe2679d9a5e43568 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Thu, 4 May 2017 12:56:16 -0700 Subject: [PATCH] Updated create command to show more info about image as it's created --- atrcopy/__init__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/atrcopy/__init__.py b/atrcopy/__init__.py index 0d854fa..c407533 100644 --- a/atrcopy/__init__.py +++ b/atrcopy/__init__.py @@ -276,7 +276,7 @@ def list_templates(): description = fh.read().strip() except IOError: description = "" - print "%-12s %s" % (os.path.basename(name), description) + print "%-14s %s" % (os.path.basename(name), description) def get_template_data(template): @@ -286,12 +286,17 @@ def get_template_data(template): data = fh.read() except: raise InvalidDiskImage("Template disk image %s not found" % template) - return data + try: + with open(path + ".inf", "r") as fh: + inf = fh.read().strip() + except IOError: + inf = "" + return data, inf def create_image(template, name): - data = get_template_data(template) - print "using %s template to create %s" % (template, name) + data, inf = get_template_data(template) + print "using %s template: %s" % (template, inf) if not options.dry_run: if os.path.exists(name) and not options.force: print "skipping %s, use -f to overwrite" % (name) @@ -299,7 +304,10 @@ def create_image(template, name): with open(name, "wb") as fh: fh.write(data) parser = find_diskimage(name) + print "created %s: %s" % (name, str(parser.image)) list_files(parser.image, []) + else: + print "creating %s" % name def run():