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 $ pass2csv --help
usage: pass2csv [-h] [-b path] [-g executable] [-a] [--encodings encodings] usage: pass2csv [-h] [-b path] [-g executable] [-a]
[-e pattern] [-f name pattern] [-l name pattern] [--encodings encodings] [-e pattern] [-f name pattern]
[-l name pattern] [--version]
STOREPATH OUTFILE STOREPATH OUTFILE
positional arguments: positional arguments:
@ -37,22 +38,25 @@ options:
-h, --help show this help message and exit -h, --help show this help message and exit
-b path, --base path path to use as base for grouping passwords -b path, --base path path to use as base for grouping passwords
-g executable, --gpg executable -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 -a, --use-agent ask gpg to use its auth agent
--encodings encodings --encodings encodings
comma-separated text encodings to try, in order, when comma-separated text encodings to try, in order,
decoding gpg output (default 'utf-8') when decoding gpg output (default: 'utf-8')
-e pattern, --exclude pattern -e pattern, --exclude pattern
regexp for lines which should not be exported, can be regexp for lines which should not be exported, can
specified multiple times be specified multiple times
-f name pattern, --get-field name pattern -f name pattern, --get-field name pattern
a name and a regexp, the part of the line matching the a name and a regexp, the part of the line matching
regexp will be removed and the remaining line will be the regexp will be removed and the remaining line
added to a field with the chosen name. only one match will be added to a field with the chosen name.
per password, matching stops after the first match only one match per password, matching stops after
the first match
-l name pattern, --get-line name pattern -l name pattern, --get-line name pattern
a name and a regexp for which all lines that match are a name and a regexp for which all lines that match
included in a field with the chosen name 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 import gnupg
__version__ = '1.0.0'
logging.basicConfig(level=logging.INFO, format='%(message)s') logging.basicConfig(level=logging.INFO, format='%(message)s')
@ -238,6 +240,12 @@ def parse_args(args=None):
dest='get_lines' dest='get_lines'
) )
parser.add_argument(
'--version',
action='version',
version='%(prog)s ' + __version__
)
return parser.parse_args(args) return parser.parse_args(args)