Package list ctdconverter / ea3e6862-d60e-433d-9df0-7a1cb727cf6e/main debian / patches / correct_name
ea3e6862-d60e-433d-9df0-7a1cb727cf6e/main

Tree @ea3e6862-d60e-433d-9df0-7a1cb727cf6e/main (Download .tar.gz)

correct_name @ea3e6862-d60e-433d-9df0-7a1cb727cf6e/mainraw · history · blame

From: Michael R. Crusoe <michael.crusoe@gmail.com>
Subject: unify script name reporting
Index: ctdconverter/convert.py
===================================================================
--- ctdconverter.orig/convert.py
+++ ctdconverter/convert.py
@@ -17,10 +17,11 @@ program_build_date = str(__updated__)
 program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
 program_short_description = "CTDConverter - A project from the WorkflowConversion family " \
                                 "(https://github.com/WorkflowConversion/CTDConverter)"
+program_name = os.path.basename(sys.argv[0])
 program_usage = '''
 USAGE:
 
-  $ python convert.py [FORMAT] [ARGUMENTS ...]
+  $ {name} [FORMAT] [ARGUMENTS ...]
 
 FORMAT can be either one of the supported output formats: cwl, galaxy.
 
@@ -30,12 +31,12 @@ documentation for each of the converters
 
 I - Parsing a single CTD file and convert it:
 
-  $ python convert.py [FORMAT] -i [INPUT_FILE] -o [OUTPUT_FILE]
+  $ {name} [FORMAT] -i [INPUT_FILE] -o [OUTPUT_FILE]
 
 
 II - Parsing several CTD files, output converted wrappers in a given folder:
 
-  $ python converter.py [FORMAT] -i [INPUT_FILES] -o [OUTPUT_DIRECTORY]
+  $ {name} [FORMAT] -i [INPUT_FILES] -o [OUTPUT_DIRECTORY]
 
 
 III - Hardcoding parameters
@@ -141,7 +142,7 @@ III - Hardcoding parameters
 
       There are, for now, no CWL-specific parameters or options.
 
-'''
+'''.format(name=program_name)
 
 program_license = '''%(short_description)s
 
@@ -174,7 +175,8 @@ def main(argv=None):
     # converter will register its own parameters after we've registered the basic ones... we have to do it old school
     if len(argv) < 2:
         utils.error("Not enough arguments provided")
-        print("\nUsage: $ python convert.py [TARGET] [ARGUMENTS]\n\n" +
+        print("\nUsage: $ {} [TARGET] "
+              " [ARGUMENTS]\n\n".format(program_name) +
               "Where:\n" +
               "  target: one of 'cwl' or 'galaxy'\n\n" +
               "Run again using the -h/--help option to print more detailed help.\n")