Skip to content

Commit

Permalink
Improved moa show output - show {{ var }} codes again [#30 state:reso…
Browse files Browse the repository at this point in the history
…lved]
  • Loading branch information
Mark Fiers committed May 30, 2011
1 parent d8dcf3d commit 691caf8
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions lib/python/moa/plugin/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,47 @@ def configShow(job):
keys = job.conf.keys()
keys.sort()

outkeys = []
outvals = []
outflags = []

for p in keys:
if p[:4] == 'moa_': continue

if job.template.parameters[p].private == True:
continue

isLocal = job.conf.is_local(p)


outkeys.append(p)

#is this variable defined?
if job.conf.setInJobConf(p):
if not isLocal:
moa.ui.fprint("%s\t{{bold}}{{magenta}}%s{{reset}}\t(recursively defined)" % (
p, job.conf[p]), f='jinja')
#yes: locally?
if job.conf.is_local(p):
outflags.append('{{green}}L{{reset}}')
else:
moa.ui.fprint("%s\t{{bold}}%s{{reset}}" % (
p, job.conf[p]), f='jinja')
outflags.append('{{magenta}}R{{reset}}')
outvals.append(job.conf[p])
else:
#not defined - does it need to be??
if job.template.parameters[p].optional:
moa.ui.fprint("%s\t{{blue}}%s{{reset}}" % (
p, job.conf[p]), f='jinja')
#no - optional
outflags.append('{{blue}}o{{reset}}')
val = job.conf[p]
if val:
outvals.append(val)
else:
outvals.append(moa.ui.fformat('{{gray}}(undefined){{reset}}', f='j'))

else:
moa.ui.fprint("%s\t{{red}}{{bold}}\t(undefined){{reset}}" % (
p), f='jinja')
#wow - not optional
outflags.append('{{bold}}{{red}}E{{reset}}')
outvals.append(moa.ui.fformat('{{red}}{{bold}}(undefined){{reset}}', f='j'))

maxKeylen = max([len(x) for x in outkeys]) + 1
for i, key in enumerate(outkeys):
moa.ui.fprint(("%%-%ds" % maxKeylen) % key, f='jinja', newline=False)
moa.ui.fprint(" " + outflags[i] + " ", f='jinja', newline=False)
moa.ui.fprint(outvals[i], f=None)

def _unsetCallback(wd, vars):
"""
Expand Down

0 comments on commit 691caf8

Please sign in to comment.