From c4d10dc08dd1f4ce810990c5d9477247116081cf Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Fri, 5 May 2017 19:16:45 -0700 Subject: [PATCH] Better formatting for template .inf files --- atrcopy/__init__.py | 10 ++++++++-- atrcopy/templates/dos33autobrun.inf | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/atrcopy/__init__.py b/atrcopy/__init__.py index 770dda9..06a7d76 100644 --- a/atrcopy/__init__.py +++ b/atrcopy/__init__.py @@ -264,6 +264,8 @@ def get_template_path(rel_path="templates"): def get_template_info(): import glob + import textwrap + fmt = " %-14s %s" path = get_template_path() files = glob.glob(os.path.join(path, "*")) @@ -278,7 +280,9 @@ def get_template_info(): description = fh.read().strip() except IOError: description = "" - lines.append(" %-14s %s" % (os.path.basename(name), description)) + d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2) + lines.append(fmt % (os.path.basename(name), d[0])) + lines.extend([fmt % ("", line) for line in d[1:]]) return os.linesep.join(lines) + os.linesep @@ -298,8 +302,10 @@ def get_template_data(template): def create_image(template, name): + import textwrap + data, inf = get_template_data(template) - print "using %s template: %s" % (template, inf) + print "using %s template:\n %s" % (template, "\n ".join(textwrap.wrap(inf, 77))) if not options.dry_run: if os.path.exists(name) and not options.force: print "skipping %s, use -f to overwrite" % (name) diff --git a/atrcopy/templates/dos33autobrun.inf b/atrcopy/templates/dos33autobrun.inf index c3dac78..b34af1b 100644 --- a/atrcopy/templates/dos33autobrun.inf +++ b/atrcopy/templates/dos33autobrun.inf @@ -1 +1 @@ -Apple ][ DOS 3.3 (140K) standard RWTS, boot to HGR & BRUN a file named AUTOBRUN +Apple ][ DOS 3.3 (140K) disk image for binary program development: HELLO sets fullscreen HGR and calls BRUN on user-supplied AUTOBRUN binary file