diff options
| -rw-r--r-- | patternutils/commands/patterncfg.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py index 7c930da..01e53fc 100644 --- a/patternutils/commands/patterncfg.py +++ b/patternutils/commands/patterncfg.py @@ -1,6 +1,8 @@ import os import os.path +from typing import Optional + import click from .. import config @@ -31,11 +33,8 @@ def list() -> None: @click.option('-c', '--command', default=None, type=click.Choice(['pmatch', 'tmv', 'targs']), help='select the command from which to view the file') @click.argument('name') -def add( - file_type: str, - command: str, - name: str, -) -> None: +def add(file_type: str, command: Optional[str], name: str) -> None: + if command == 'pmatch': fileext = 'regex' else: @@ -51,7 +50,7 @@ def add( @click.option('-c', '--command', default=None, type=click.Choice(['pmatch', 'tmv', 'targs']), help='select the command from which to view the file') @click.argument('name') -def remove(command: str, name: str) -> None: +def remove(command: Optional[str], name: str) -> None: files = config.find_templates(name, command) try: os.remove(files[0]) |
