From 0561300ebe206d691a7e842964b86f236453bd25 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Fri, 2 Aug 2019 00:09:08 +0300 Subject: [PATCH] Add option to print version with `--version` or `-V` I guess `-v` is more commonly used for "verbose" so I will use the short option of `-V` for version. --- csv_metadata_quality/app.py | 2 ++ csv_metadata_quality/version.py | 1 + 2 files changed, 3 insertions(+) create mode 100644 csv_metadata_quality/version.py diff --git a/csv_metadata_quality/app.py b/csv_metadata_quality/app.py index 953f961..f88360a 100644 --- a/csv_metadata_quality/app.py +++ b/csv_metadata_quality/app.py @@ -1,3 +1,4 @@ +from csv_metadata_quality.version import VERSION import argparse import csv_metadata_quality.check as check import csv_metadata_quality.fix as fix @@ -11,6 +12,7 @@ def parse_args(argv): parser.add_argument('--input-file', '-i', help='Path to input file. Can be UTF-8 CSV or Excel XLSX.', required=True, type=argparse.FileType('r', encoding='UTF-8')) parser.add_argument('--output-file', '-o', help='Path to output file (always CSV).', required=True, type=argparse.FileType('w', encoding='UTF-8')) parser.add_argument('--unsafe-fixes', '-u', help='Perform unsafe fixes.', action='store_true') + parser.add_argument('--version', '-V', action='version', version=f'CSV Metadata Quality v{VERSION}') args = parser.parse_args() return args diff --git a/csv_metadata_quality/version.py b/csv_metadata_quality/version.py new file mode 100644 index 0000000..a4e55ec --- /dev/null +++ b/csv_metadata_quality/version.py @@ -0,0 +1 @@ +VERSION = '0.0.1'