diff --git a/CHANGELOG.md b/CHANGELOG.md index 717f88067..2d59a2350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] +### Added +- Added command line argument --list-modules which will list modules + and exit. It can be followed by "essential" or "optional" to only + list those modules. + ## [0.12.0] - 2016-12-08 ### Added - Added screenshots to Readme. @@ -163,6 +169,7 @@ All notable changes to this project will be documented in this file. - Fixed issue that could allow someone to start a module setup process without being logged in to Plinth. +[Unreleased]: https://github.com/freedombox/Plinth/compare/v0.12.0...HEAD [0.12.0]: https://github.com/freedombox/Plinth/compare/v0.11.0...v0.12.0 [0.11.0]: https://github.com/freedombox/Plinth/compare/v0.10.0...v0.11.0 [0.10.0]: https://github.com/freedombox/Plinth/compare/v0.9.4...v0.10.0 diff --git a/plinth/__main__.py b/plinth/__main__.py index bd1de16d3..eeb92811b 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -65,7 +65,7 @@ def parse_arguments(): help='list package dependencies for essential modules') parser.add_argument( '--list-modules', default=False, nargs='*', - help='list of enabled modules') + help='list modules') global arguments arguments = parser.parse_args() @@ -288,20 +288,18 @@ def list_dependencies(module_list): sys.exit(error_code) -def list_modules(modules_type) : - """List all enabled modules""" +def list_modules(modules_type): + """List all/essential/optional modules and exit.""" for module_name, module in module_loader.loaded_modules.items(): - if modules_type: - if 'essential' in modules_type : - if getattr(module, 'is_essential', False) is True : - print('{module_name}'.format(module_name=module_name)) - else: - if getattr(module, 'is_essential', False) is False : - print('{module_name}'.format(module_name=module_name)) - else: - print('{module_name}'.format(module_name=module_name)) + module_is_essential = getattr(module, 'is_essential', False) + if 'essential' in modules_type and not module_is_essential: + continue + elif 'optional' in modules_type and module_is_essential: + continue + print('{module_name}'.format(module_name=module_name)) sys.exit() + def run_diagnostics_and_exit(): """Run diagostics on all modules and exit.""" module = importlib.import_module('plinth.modules.diagnostics.diagnostics') @@ -353,7 +351,6 @@ def main(): if arguments.diagnose: run_diagnostics_and_exit() - setup_server() cherrypy.engine.start()