correct name
Michael R. Crusoe
5 years ago
0 | From: Michael R. Crusoe <michael.crusoe@gmail.com> | |
1 | Subject: unify script name reporting | |
2 | --- ctdconverter.orig/convert.py | |
3 | +++ ctdconverter/convert.py | |
4 | @@ -17,10 +17,11 @@ | |
5 | program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) | |
6 | program_short_description = "CTDConverter - A project from the WorkflowConversion family " \ | |
7 | "(https://github.com/WorkflowConversion/CTDConverter)" | |
8 | +program_name = os.path.basename(sys.argv[0]) | |
9 | program_usage = ''' | |
10 | USAGE: | |
11 | ||
12 | - $ python convert.py [FORMAT] [ARGUMENTS ...] | |
13 | + $ {name} [FORMAT] [ARGUMENTS ...] | |
14 | ||
15 | FORMAT can be either one of the supported output formats: cwl, galaxy. | |
16 | ||
17 | @@ -30,12 +31,12 @@ | |
18 | ||
19 | I - Parsing a single CTD file and convert it: | |
20 | ||
21 | - $ python convert.py [FORMAT] -i [INPUT_FILE] -o [OUTPUT_FILE] | |
22 | + $ {name} [FORMAT] -i [INPUT_FILE] -o [OUTPUT_FILE] | |
23 | ||
24 | ||
25 | II - Parsing several CTD files, output converted wrappers in a given folder: | |
26 | ||
27 | - $ python converter.py [FORMAT] -i [INPUT_FILES] -o [OUTPUT_DIRECTORY] | |
28 | + $ {name} [FORMAT] -i [INPUT_FILES] -o [OUTPUT_DIRECTORY] | |
29 | ||
30 | ||
31 | III - Hardcoding parameters | |
32 | @@ -141,7 +142,7 @@ | |
33 | ||
34 | There are, for now, no CWL-specific parameters or options. | |
35 | ||
36 | -''' | |
37 | +'''.format(name=program_name) | |
38 | ||
39 | program_license = '''%(short_description)s | |
40 | ||
41 | @@ -174,7 +175,8 @@ | |
42 | # converter will register its own parameters after we've registered the basic ones... we have to do it old school | |
43 | if len(argv) < 2: | |
44 | utils.error("Not enough arguments provided") | |
45 | - print("\nUsage: $ python convert.py [TARGET] [ARGUMENTS]\n\n" + | |
46 | + print("\nUsage: $ {} [TARGET] " | |
47 | + " [ARGUMENTS]\n\n".format(program_name) + | |
48 | "Where:\n" + | |
49 | " target: one of 'cwl' or 'galaxy'\n\n" + | |
50 | "Run again using the -h/--help option to print more detailed help.\n") |