Skip to content

Commit

Permalink
minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Sep 24, 2012
1 parent f40a0aa commit be5a8d7
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/python/moa/plugin/system/template.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
#
# Licensed under the GPL license (see 'COPYING')
#
#
"""
**template** - information on templates
-------------------------------------------
Expand All @@ -22,6 +23,7 @@

from moa.sysConf import sysConf


@moa.args.needsJob
@moa.args.command
def refresh(job, args):
Expand All @@ -32,17 +34,19 @@ def refresh(job, args):
"""
job.refreshTemplate()


def hook_git_finish_refresh():
sysConf.git.commitJob(sysConf.job, 'moa refresh (%s)' % sysConf.job.wd)


def _getTemplateFromData(job):
"""
Return a relevant template, either the one specified, or the template
that the current directory refers to
:param data: global data structure, containing all relevant information
:type data: dict
"""
args = sysConf['newargs']
if len(args) > 0 and not '=' in args[0]:
Expand All @@ -55,6 +59,7 @@ def _getTemplateFromData(job):

return template


# def templateSet(job):
# """
# **moa template_set** - set a template parameter.
Expand Down Expand Up @@ -87,14 +92,16 @@ def list(job, args):
if args.desc:
ti = moa.template.getMoaFile(name)
txt = moa.ui.fformat(
'{{bold}}%s{{reset}}:{{cyan}} %s{{reset}}' % (name, ti.description),
'{{bold}}%s{{reset}}:{{cyan}} %s{{reset}}'
% (name, ti.description),
f='jinja')
for line in textwrap.wrap(txt, initial_indent=' - ', width=80,
subsequent_indent = ' '):
subsequent_indent=' '):
print line
else:
print name


@moa.args.private
@moa.args.command
def template(job, args):
Expand All @@ -105,10 +112,11 @@ def template(job, args):
moa template
"""
moa.ui.fprint(job.template.name)


@moa.args.private
@moa.args.command
def dumpTemplate(job, args):
Expand Down

0 comments on commit be5a8d7

Please sign in to comment.