-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp.py
More file actions
31 lines (27 loc) · 866 Bytes
/
Help.py
File metadata and controls
31 lines (27 loc) · 866 Bytes
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
#!/usr/bin/env python
# Basic module to load helper config
import yaml
import string
#helpFile = open('basichelp.yaml')
helpFile = open('help.yaml')
helpMessages = yaml.load(helpFile)
def getHelp(topic=None):
if not topic:
topicString = "Topics: " + string.join(helpMessages, ", ")
return topicString
elif topic in helpMessages:
return helpMessages[topic]
else:
return "No matching help topics found"
def getHelp2(topic):
if not topic:
return getHelp2("about")
else:
helpBase = helpMessages[topic]
messages = [helpBase["topic"]]
if "subtopics" in helpBase and helpBase["subtopics"] != None:
subtopics = "Subtopics:"
for subt in helpBase["subtopics"]:
subtopics += subt + " "
messages.append(subtopics)
return messages