-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskeleton.py
More file actions
59 lines (51 loc) · 1.53 KB
/
skeleton.py
File metadata and controls
59 lines (51 loc) · 1.53 KB
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
52
53
54
55
56
57
58
59
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: skeleton.py
# Purpose: Skeleton file for easier and more consistent creation of files
#
# Author: Rune "TheFlyingCorpse" Darrud
#
# Created: 21.01.2012
# Copyright: (c) Rune "TheFlyingCorpse" Darrud 2012
# Licence: GPL 2
#-------------------------------------------------------------------------------
import sys, getopt
sys.path.append('../lib/')
sys.path.append('lib/')
from ruleeval import ruleeval
# Make it shorter
r = ruleeval()
def usage():
print(sys.argv[0] + " - Forward notifcations to NoHa")
print("")
print("Valid options are:")
print(" -h, --help Prints this message")
print(" -v Verbose output")
print(" -D Debug output")
print("")
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "Dhv", ["help"])
except getopt.GetoptError, err:
#print help information and exit:
print(str(err))
usage()
sys.exit(2)
# Set defaults
verbose = False
debug = False
# Loop through all arguments
for o, a in opts:
if o == "-v":
verbose = True
elif o == "-D":
debug = True
elif o in ("-h", "--help"):
usage()
sys.exit()
else:
assert False, "unhandled option"
# Call SOME function to pass on the information
FUNCTION(debug, verbose, args*)
if __name__ == "__main__":
main()