Better formatting for template .inf files

This commit is contained in:
Rob McMullen 2017-05-05 19:16:45 -07:00
parent 1b1e7b1eb8
commit c4d10dc08d
2 changed files with 9 additions and 3 deletions

View File

@ -264,6 +264,8 @@ def get_template_path(rel_path="templates"):
def get_template_info(): def get_template_info():
import glob import glob
import textwrap
fmt = " %-14s %s"
path = get_template_path() path = get_template_path()
files = glob.glob(os.path.join(path, "*")) files = glob.glob(os.path.join(path, "*"))
@ -278,7 +280,9 @@ def get_template_info():
description = fh.read().strip() description = fh.read().strip()
except IOError: except IOError:
description = "" 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 return os.linesep.join(lines) + os.linesep
@ -298,8 +302,10 @@ def get_template_data(template):
def create_image(template, name): def create_image(template, name):
import textwrap
data, inf = get_template_data(template) 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 not options.dry_run:
if os.path.exists(name) and not options.force: if os.path.exists(name) and not options.force:
print "skipping %s, use -f to overwrite" % (name) print "skipping %s, use -f to overwrite" % (name)

View File

@ -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