comparison parpg.py @ 4:6ad756581ef1

Added parpg.py and a default configuration.
author KarstenBock@gmx.net
date Thu, 12 Jan 2012 18:51:18 +0100
parents
children 8da675d9f525
comparison
equal deleted inserted replaced
3:30bcf64f483d 4:6ad756581ef1
1 #!/usr/bin/env python2
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
6
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
15 #TODO: Modularize this script
16 import sys
17 from optparse import OptionParser
18 from os import path
19
20 from parpg.main import main
21
22 usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n'
23 'The settings_path argument is mandatory and is the directory in \n'
24 'which your parpg.cfg file is located. Optionally, you may \n'
25 'specify where data files are located (system_path), and where \n'
26 'the user settings and data files should be saved to (user_path)\n\n'
27 'Example: python %prog .')
28
29 parser = OptionParser(description='PARPG Launcher Script', usage=usage)
30 parser.add_option('-f', '--logfile',
31 help='Name of log file to save to')
32 parser.add_option('-l', '--loglevel', default='critical',
33 help='desired output level for log file')
34 opts, args = parser.parse_args()
35
36 if not args:
37 if path.isfile("./parpg.cfg"):
38 args =(".")
39 else:
40 parser.print_help()
41 sys.exit(1)
42
43 main(args, opts)