summaryrefslogtreecommitdiffstats
path: root/classes/help.py
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-01-09 19:38:04 +0100
committernico <nico@magicbroccoli.de>2019-01-09 19:38:04 +0100
commit134a674228b3d2b42cb7fe2a12f215a225e7544b (patch)
tree0643df4b2c3e0d0368eab6a2c01625fcb04d801f /classes/help.py
parent9c3f6761e5f7749125a0d4939cd1809aabdfd2be (diff)
initial rework of the implemented functionsdev
+ added __init__ import file for all functions + added new helper function + added strings.json file * some logic fixups * validator fixup * arg abbreviation moved to misc
Diffstat (limited to 'classes/help.py')
-rw-r--r--classes/help.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/help.py b/classes/help.py
new file mode 100644
index 0000000..c268520
--- /dev/null
+++ b/classes/help.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from common.misc import arg_abbr
+from common.strings import StaticAnswers
+import json
+
+
+class Helper:
+ def __init__(self):
+ self.possible_vars = StaticAnswers().helpfile["help_advanced"].keys()
+
+ def receive(self, target):
+ # optional argument abbreviation
+ target = arg_abbr(target, self.possible_vars)
+
+ if target in self.possible_vars:
+ return StaticAnswers().help_doc(target)
+ else:
+ return StaticAnswers().help_doc()
+
+ def format(self, query, target, opt_arg):
+ doc = self.receive(target)
+
+ if target in self.possible_vars:
+ answer = json.dumps(StaticAnswers().help_doc(target), indent=4)
+
+ else:
+ answer = "\n".join(['%s' % value for (_, value) in doc.items()])
+
+ return answer