aboutsummaryrefslogtreecommitdiff
path: root/modules/printconf.py
blob: 708c421afbe2619ff6a599ac1b0552f57191c638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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