From 9a999c599dad8375d66531bd20c9e4ea0b642845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 15 Sep 2015 09:52:25 +0200 Subject: Implement new module printconf --- modules/printconf.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 modules/printconf.py (limited to 'modules/printconf.py') diff --git a/modules/printconf.py b/modules/printconf.py new file mode 100644 index 0000000..708c421 --- /dev/null +++ b/modules/printconf.py @@ -0,0 +1,51 @@ +import os +import sys +import re +import utils +from utils import conf + +services = ( + utils.Service.argument, + utils.Service.action, + ) + +__conf_file__ = False + +def argument(args): + global __conf_file__ + if args[0] == '--file': + __conf_file__ = True + return 1 + +def argument_short(l, args): + return 0 + +def argument_exec(): + conf.argument_conffile = __conf_file__ + +def argument_help(): + if conf.action == 'config': + print(' --file') + print(' Print only used configuration file.') + +def action(args): + if conf.action == None and args[0].lower() == 'config': + conf.action = 'config' + conf.action_module = sys.modules[__name__] + return 1 + return 0 + +def action_exec(): + if conf.argument_conffile: + try: + print(conf.__file__) + except AttributeError: + print('Default configuration used. No file associated.') + else: + print('TODO') + +def action_help(): + pass + +def action_full_help(): + pass -- cgit v1.2.3