diff options
Diffstat (limited to '')
| -rw-r--r-- | patternutils/commands/patterncfg.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py index 231940c..e2432d6 100644 --- a/patternutils/commands/patterncfg.py +++ b/patternutils/commands/patterncfg.py @@ -24,10 +24,14 @@ def init() -> None: @patterncfg.command(name='list', help='list all patternutils template files') def list() -> None: - for d in os.listdir(config.CONFIG_PATH): - click.secho(d, fg='blue') - for f in os.listdir(os.path.join(config.CONFIG_PATH, d)): - click.echo('└── {}'.format(f)) + try: + for d in os.listdir(config.CONFIG_PATH): + click.secho(d, fg='blue') + for f in os.listdir(os.path.join(config.CONFIG_PATH, d)): + click.echo('└── {}'.format(f)) + except FileNotFoundError as e: + click.secho('{} not found! Please run patterncfg init first.'.format(e.filename), fg='red', err=True) + raise SystemExit @patterncfg.command(name='add', help='add new template file') |
