From d0209dbdea5e22624159100221b2edf213142592 Mon Sep 17 00:00:00 2001 From: Rupus Reinefjord Date: Wed, 17 Jan 2024 12:47:38 +0100 Subject: [PATCH] add --version --- README.md | 30 +++++++++++++++++------------- pass2csv | 8 ++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 38e403b..c416620 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,9 @@ or with pip: ``` $ pass2csv --help -usage: pass2csv [-h] [-b path] [-g executable] [-a] [--encodings encodings] - [-e pattern] [-f name pattern] [-l name pattern] +usage: pass2csv [-h] [-b path] [-g executable] [-a] + [--encodings encodings] [-e pattern] [-f name pattern] + [-l name pattern] [--version] STOREPATH OUTFILE positional arguments: @@ -37,22 +38,25 @@ options: -h, --help show this help message and exit -b path, --base path path to use as base for grouping passwords -g executable, --gpg executable - path to the gpg binary you wish to use (default 'gpg') + path to the gpg binary you wish to use (default: + 'gpg') -a, --use-agent ask gpg to use its auth agent --encodings encodings - comma-separated text encodings to try, in order, when - decoding gpg output (default 'utf-8') + comma-separated text encodings to try, in order, + when decoding gpg output (default: 'utf-8') -e pattern, --exclude pattern - regexp for lines which should not be exported, can be - specified multiple times + regexp for lines which should not be exported, can + be specified multiple times -f name pattern, --get-field name pattern - a name and a regexp, the part of the line matching the - regexp will be removed and the remaining line will be - added to a field with the chosen name. only one match - per password, matching stops after the first match + a name and a regexp, the part of the line matching + the regexp will be removed and the remaining line + will be added to a field with the chosen name. + only one match per password, matching stops after + the first match -l name pattern, --get-line name pattern - a name and a regexp for which all lines that match are - included in a field with the chosen name + a name and a regexp for which all lines that match + are included in a field with the chosen name + --version show program's version number and exit ``` diff --git a/pass2csv b/pass2csv index d640f8d..abb3d37 100755 --- a/pass2csv +++ b/pass2csv @@ -8,6 +8,8 @@ import sys import gnupg +__version__ = '1.0.0' + logging.basicConfig(level=logging.INFO, format='%(message)s') @@ -238,6 +240,12 @@ def parse_args(args=None): dest='get_lines' ) + parser.add_argument( + '--version', + action='version', + version='%(prog)s ' + __version__ + ) + return parser.parse_args(args)