@@ -1045,24 +1045,6 @@ def isvalid_about_file(file_name):
10451045 Output must be a file with a .csv extension.
10461046"""
10471047
1048-
1049- def syntax ():
1050- print (SYNTAX )
1051-
1052-
1053- def option_usage ():
1054- print ("""
1055- Options:
1056- --overwrite Overwrites the output file if it exists
1057- -v,--version Display current version, license notice, and copyright notice
1058- -h,--help Display help
1059- --verbosity <arg> Print more or less verbose messages while processing ABOUT files
1060- <arg>
1061- 0 - Do not print any warning or error messages, just a total count (default)
1062- 1 - Print error messages
1063- 2 - Print error and warning messages
1064- """ )
1065-
10661048VERSION = """
10671049ABOUT CODE: Version: {0}
10681050Copyright (c) 2013 nexB Inc. All rights reserved.
@@ -1077,12 +1059,13 @@ def option_usage():
10771059See the License for the specific language governing permissions and limitations
10781060under the License.""" .format (__version__ )
10791061
1080-
1081- def version ():
1082- print (VERSION )
1062+ VERBOSITY = """Print more or fewer verbose messages while processing ABOUT files
1063+ 0 - Do not print any warning or error messages, just a total count (default)
1064+ 1 - Print error messages
1065+ 2 - Print error and warning messages"""
10831066
10841067
1085- def main (args ):
1068+ def main (parser , args ):
10861069 overwrite = args .overwrite
10871070 verbosity = args .verbosity
10881071 input_path = args .input_path
@@ -1093,25 +1076,24 @@ def main(args):
10931076 output_path = abspath (output_path )
10941077
10951078 if not exists (input_path ):
1096- print ('Input path does not exist.' )
1097- option_usage ()
1079+ print ('Input path does not exist.\n ' )
1080+ parser . print_help ()
10981081 sys .exit (errno .EEXIST )
10991082
11001083 if isdir (output_path ):
1101- print ('Output must be a file, not a directory.' )
1102- option_usage ()
1084+ print ('Output must be a file, not a directory.\n ' )
1085+ parser . print_help ()
11031086 sys .exit (errno .EISDIR )
11041087
11051088 if not output_path .endswith ('.csv' ):
1106- print ("Output file name must end with '.csv'" )
1107- syntax ()
1108- option_usage ()
1089+ print ("Output file name must end with '.csv'\n " )
1090+ parser .print_help ()
11091091 sys .exit (errno .EINVAL )
11101092
11111093 if exists (output_path ) and not overwrite :
11121094 print ('Output file already exists. Select a different file name or use '
1113- 'the --overwrite option.' )
1114- option_usage ()
1095+ 'the --overwrite option.\n ' )
1096+ parser . print_help ()
11151097 sys .exit (errno .EEXIST )
11161098
11171099 if not exists (output_path ) or (exists (output_path ) and overwrite ):
@@ -1130,14 +1112,10 @@ def main(args):
11301112 parser .add_argument ('-v' , '--version' , action = 'version' , version = VERSION ,
11311113 help = 'Display current version, license notice, and '
11321114 'copyright notice' )
1133- VERBOSITY = """Print more or fewer verbose messages while processing ABOUT files
1134- 0 - Do not print any warning or error messages, just a total count (default)
1135- 1 - Print error messages
1136- 2 - Print error and warning messages"""
11371115 parser .add_argument ('--verbosity' , type = int , choices = [0 , 1 , 2 ],
11381116 help = VERBOSITY )
11391117 parser .add_argument ('input_path' , help = 'The input path' )
11401118 parser .add_argument ('output_path' , help = 'The output path' )
11411119 args = parser .parse_args ()
11421120
1143- main (args )
1121+ main (parser , args )
0 commit comments