diff options
| author | Dennis Fink | 2019-08-28 20:10:00 +0200 |
|---|---|---|
| committer | Dennis Fink | 2019-08-28 20:10:00 +0200 |
| commit | ebd45b7aaa977ec45963698561c4633f48a6960c (patch) | |
| tree | 2db3a15f3545ca0c6775740be18461bf87f249cc | |
| parent | 9600644e9f2c2dddd7b982db3cb128708054ceb8 (diff) | |
| download | patternutils-ebd45b7aaa977ec45963698561c4633f48a6960c.tar.gz patternutils-ebd45b7aaa977ec45963698561c4633f48a6960c.zip | |
Prettify
Diffstat (limited to '')
| -rw-r--r-- | patternutils/commands/patterncfg.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py index 01e53fc..434387d 100644 --- a/patternutils/commands/patterncfg.py +++ b/patternutils/commands/patterncfg.py @@ -43,7 +43,8 @@ def add(file_type: str, command: Optional[str], name: str) -> None: else: fileext = file_type - click.edit(filename=os.path.join(config.CONFIG_PATH, command, '.'.join((name, fileext)))) + filename = os.path.join(config.CONFIG_PATH, command, '{}.{}'.format(name, fileext)) + click.edit(filename=filename) @patterncfg.command(name='remove', help='remove template file') @@ -51,6 +52,7 @@ def add(file_type: str, command: Optional[str], name: str) -> None: help='select the command from which to view the file') @click.argument('name') def remove(command: Optional[str], name: str) -> None: + files = config.find_templates(name, command) try: os.remove(files[0]) @@ -77,6 +79,7 @@ def view(name: str, command: str) -> None: raise SystemExit else: filename = files[0] + try: with open(filename, encoding='utf-8') as fd: text = fd.read() |
