Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kliment/Printrun.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRock Storm <rockstorm@gmx.com>2016-03-13 13:21:56 +0300
committerRock Storm <rockstorm@gmx.com>2016-03-13 13:21:56 +0300
commit3ef393e94c3516ade8e20c539441c274649f538f (patch)
tree4c64d41035aa67f258c58ffbd920b5ec216a1d3a /pronsole.py
parent3269eb2fd4f6e1dad3672607822e32587678fbd5 (diff)
Add or fix help messages for main scripts
Diffstat (limited to 'pronsole.py')
-rwxr-xr-xpronsole.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pronsole.py b/pronsole.py
index 04c2512..fc8fb48 100755
--- a/pronsole.py
+++ b/pronsole.py
@@ -19,9 +19,32 @@ import sys
import traceback
import logging
from printrun.pronsole import pronsole
+import getopt
if __name__ == "__main__":
+ from printrun.printcore import __version__ as printcore_version
+
+ usage = "Usage:\n"+\
+ " pronsole [OPTION]\n\n"+\
+ "Options:\n"+\
+ " -V, --version\t\t\tPrint program's version number and exit\n"+\
+ " -h, --help\t\t\tPrint this help message and exit\n"
+
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version"])
+ except getopt.GetoptError, err:
+ print str(err)
+ print usage
+ sys.exit(2)
+ for o, a in opts:
+ if o in ('-V','--version'):
+ print "printrun "+printcore_version
+ sys.exit(0)
+ elif o in ('-h', '--help'):
+ print usage
+ sys.exit(0)
+
interp = pronsole()
interp.parse_cmdline(sys.argv[1:])
try: