29 Module function to show the usage information. |
29 Module function to show the usage information. |
30 |
30 |
31 @param appinfo dictionary describing the application |
31 @param appinfo dictionary describing the application |
32 @param optlen length of the field for the commandline option (integer) |
32 @param optlen length of the field for the commandline option (integer) |
33 """ |
33 """ |
34 options = [\ |
34 options = [ |
35 ("--version", "show the program's version number and exit"), |
35 ("--version", "show the program's version number and exit"), |
36 ("-h, --help", "show this help message and exit") |
36 ("-h, --help", "show this help message and exit") |
37 ] |
37 ] |
38 options.extend(appinfo["options"]) |
38 options.extend(appinfo["options"]) |
39 |
39 |
40 print(""" |
40 print("""\n""" |
41 Usage: {bin} [OPTIONS] {arg} |
41 """Usage: {bin} [OPTIONS] {arg}\n""" |
42 |
42 """\n""" |
43 {name} - {description} |
43 """{name} - {description}\n""" |
44 |
44 """\n""" |
45 Options:""".format(**appinfo)) |
45 """Options:""".format(**appinfo)) |
46 for opt in options: |
46 for opt in options: |
47 print(" {0} {1}".format(opt[0].ljust(optlen), opt[1])) |
47 print(" {0} {1}".format(opt[0].ljust(optlen), opt[1])) |
48 sys.exit(0) |
48 sys.exit(0) |
49 |
49 |
50 |
50 |
52 """ |
52 """ |
53 Module function to show the version information. |
53 Module function to show the version information. |
54 |
54 |
55 @param appinfo dictionary describing the application |
55 @param appinfo dictionary describing the application |
56 """ |
56 """ |
57 print(""" |
57 print("""\n""" |
58 {name} {version} |
58 """{name} {version}\n""" |
59 |
59 """\n""" |
60 {description} |
60 """{description}\n""" |
61 |
61 """\n""" |
62 Copyright (c) 2002 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
62 """Copyright (c) 2002 - 2013 Detlev Offenbach""" |
63 This is free software; see LICENSE.GPL3 for copying conditions. |
63 """ <detlev@die-offenbachs.de>\n""" |
64 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A |
64 """This is free software; see LICENSE.GPL3 for copying""" |
65 PARTICULAR PURPOSE.""".format(**appinfo)) |
65 """ conditions.\n""" |
|
66 """There is NO warranty; not even for MERCHANTABILITY or FITNESS""" |
|
67 """ FOR A\n""" |
|
68 """PARTICULAR PURPOSE.""".format(**appinfo)) |
66 sys.exit(0) |
69 sys.exit(0) |
67 |
70 |
68 |
71 |
69 def handleArgs(argv, appinfo): |
72 def handleArgs(argv, appinfo): |
70 """ |
73 """ |