Add metavar

This commit is contained in:
Augusto Gunsch 2022-11-15 18:44:50 +01:00
parent 9616c26cb8
commit bbe005e243
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
4 changed files with 4 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
venv/ venv/
*.egg-info/ *.egg-info/
__pycache__/ __pycache__/
*.test_*.srt
dist/ dist/

View File

@ -9,7 +9,7 @@ python3.9 -m pip install subprompt
## Usage ## Usage
``` ```
usage: subprompt.py [-h] (-d | -r R) [-n N] REGEX FILES [FILES ...] usage: subprompt [-h] (-d | -r SUB) [-n N] REGEX FILES [FILES ...]
Modifies lines matched by a regex interactively Modifies lines matched by a regex interactively
@ -20,6 +20,6 @@ positional arguments:
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-d delete line -d delete line
-r R replace match with expression -r SUB replace match with expression
-n N size of lines preview (default=3) -n N size of lines preview (default=3)
``` ```

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = subprompt name = subprompt
version = 0.0.7 version = 0.0.9
author = Augusto Lenz Gunsch author = Augusto Lenz Gunsch
author_email = augusto@augustogunsch.com author_email = augusto@augustogunsch.com
description = Substitute Regex in files with prompt confirmation description = Substitute Regex in files with prompt confirmation

View File

@ -166,7 +166,7 @@ def run(args):
parser.add_argument('regex', metavar='REGEX', type=str) parser.add_argument('regex', metavar='REGEX', type=str)
action = parser.add_mutually_exclusive_group(required=True) action = parser.add_mutually_exclusive_group(required=True)
action.add_argument('-d', help='delete line', action='store_true') action.add_argument('-d', help='delete line', action='store_true')
action.add_argument('-r', help='replace match with expression', type=str) action.add_argument('-r', help='replace match with expression', type=str, metavar='SUB')
parser.add_argument('files', metavar='FILES', nargs='+', type=str) parser.add_argument('files', metavar='FILES', nargs='+', type=str)
parser.add_argument('-n', help='size of lines preview (default=3)', type=int, default=3) parser.add_argument('-n', help='size of lines preview (default=3)', type=int, default=3)