diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parpg.py	Thu Jan 12 18:51:18 2012 +0100
@@ -0,0 +1,43 @@
+#!/usr/bin/env python2 
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#TODO: Modularize this script
+import sys
+from optparse import OptionParser
+from os import path
+
+from parpg.main import main
+
+usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n'
+         'The settings_path argument is mandatory and is the directory in \n'
+         'which your parpg.cfg file is located. Optionally, you may \n'
+         'specify where data files are located (system_path), and where \n'
+         'the user settings and data files should be saved to (user_path)\n\n'
+         'Example: python %prog .')
+
+parser = OptionParser(description='PARPG Launcher Script', usage=usage)
+parser.add_option('-f', '--logfile',
+                  help='Name of log file to save to')
+parser.add_option('-l', '--loglevel', default='critical',
+                  help='desired output level for log file')
+opts, args = parser.parse_args()
+
+if not args:
+    if path.isfile("./parpg.cfg"):
+        args =(".")
+    else:
+        parser.print_help()
+        sys.exit(1)
+
+main(args, opts)
\ No newline at end of file