From 9600644e9f2c2dddd7b982db3cb128708054ceb8 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Wed, 28 Aug 2019 20:09:27 +0200 Subject: Use correct type annotations --- patternutils/commands/patterncfg.py | 11 +++++------ 1 file 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]) -- cgit v1.3.1