mirror of https://github.com/buildinspace/peru.git
adding module list command
This commit is contained in:
parent
20bf6fd117
commit
f81936cee0
25
peru/main.py
25
peru/main.py
|
@ -229,6 +229,31 @@ def do_override(params):
|
||||||
module, params.runtime.get_override(module)))
|
module, params.runtime.get_override(module)))
|
||||||
|
|
||||||
|
|
||||||
|
@peru_command('module', '''\
|
||||||
|
Usage:
|
||||||
|
peru module <list> [-z]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-z print one module per line for machine-readable formatting
|
||||||
|
|
||||||
|
''')
|
||||||
|
def do_list(params):
|
||||||
|
modules = params.scope.modules.values()
|
||||||
|
output = ''
|
||||||
|
delim = ' | ' if params.args['-z'] else "\n "
|
||||||
|
|
||||||
|
for module in modules:
|
||||||
|
output += module.name
|
||||||
|
for field, val in module.plugin_fields.items():
|
||||||
|
output += '{}{}: {}'.format(delim, field, val)
|
||||||
|
if(params.runtime.get_override(module.name)):
|
||||||
|
output += '{}{}: {}'.format(delim, 'override', params.runtime.get_override(module.name))
|
||||||
|
output += '\n'
|
||||||
|
|
||||||
|
if (output):
|
||||||
|
params.runtime.display.print(output[:-1])
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
version_file = os.path.join(compat.MODULE_ROOT, 'VERSION')
|
version_file = os.path.join(compat.MODULE_ROOT, 'VERSION')
|
||||||
with open(version_file) as f:
|
with open(version_file) as f:
|
||||||
|
|
Loading…
Reference in New Issue