add command-line parser to Qwad,

currently only --help and --version
This commit is contained in:
Christopher Roy Bratusek 2012-11-11 11:09:15 +01:00
parent af23c01708
commit 56e994f31e

View File

@ -1,10 +1,24 @@
#!/usr/bin/env python2 #!/usr/bin/env python
#-*- coding: utf-8 -*- #coding=utf-8
import sys import sys
import optparse
from PyQt4.QtGui import QApplication from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QTranslator, QString, QLocale from PyQt4.QtCore import QTranslator, QString, QLocale
from GUI.VenPri import MWQwad from GUI.VenPri import MWQwad
parser = optparse.OptionParser("qwad <option> [value]\
\n\nQwad (c) 2012 Christopher Roy Bratusek\
\nLicensed under the GNU GENERAL PUBLIC LICENSE v3")
parser.add_option("-v", "--version", dest="version",
action="store_true", default=False, help="print version and exit")
(options, args) = parser.parse_args()
if options.version:
print "0.6"
sys.exit(0)
if __name__ == "__main__": if __name__ == "__main__":
translator = QTranslator() translator = QTranslator()
translator.load(QString("i18n/Qwad_%1").arg(QLocale.system().name())) translator.load(QString("i18n/Qwad_%1").arg(QLocale.system().name()))