diff --git a/gpxcsv/__init__.py b/gpxcsv/__init__.py index 7fcc155..f7b44bb 100644 --- a/gpxcsv/__init__.py +++ b/gpxcsv/__init__.py @@ -153,7 +153,7 @@ def _list_to_csv(self, list_of_dicts, csv_file): for row in list_of_dicts: mywriter.writerow(row) self._check_verbose_print( - f"CSV {csv_file} written with {len(list_of_dicts)} rows", + f"CSV {csv_file} written to {csv_file} with {len(list_of_dicts)} rows", force=True) if self.verbose: #leaving this in an if statement because of the column formatting for now diff --git a/gpxcsv/__main__.py b/gpxcsv/__main__.py index 77c3ed5..d84a6b9 100644 --- a/gpxcsv/__main__.py +++ b/gpxcsv/__main__.py @@ -1,11 +1,20 @@ import glob import argparse +import sys + from . import GpxCSV +class MyParser(argparse.ArgumentParser): + def error(self, message): + sys.stderr.write('error: %s\n' % message) + self.print_help() + sys.exit(2) + + def main(): """Main function for command line utility""" - parser = argparse.ArgumentParser() + parser = MyParser() parser.add_argument( 'input_file', nargs='+',