-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathliferay.py
48 lines (39 loc) · 862 Bytes
/
liferay.py
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
#!/usr/bin/python
"""
Master script for invoking any python script in this repository.
This script exists as a convenience to set up just a single alias to execute many python scripts.
Available commands are:
populate
setup
switch
test_pr
Example usage: python liferay.py test_pr [pr_url]
"""
##
## Imports
##
import sys
import populate
import setup
import switch
import test_pr
##
## Main
##
if __name__ == "__main__":
if len(sys.argv) > 1:
# get the main method of the indicated script
try:
func = getattr(__import__(sys.argv[1]), 'main')
except (AttributeError, ImportError) as e:
print('{} is not a valid command.'.format(sys.argv[1]))
print(__doc__)
sys.exit(1)
# execute the main method with the indicated list of arguments
if len(sys.argv) > 2:
func(sys.argv[2:])
else:
func()
else:
print(__doc__)
sys.exit(1)