add --version

This commit is contained in:
Rupus Reinefjord 2024-01-17 12:47:38 +01:00
parent 41f340a595
commit d0209dbdea
2 changed files with 25 additions and 13 deletions

View file

@ -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
```

View file

@ -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)