aboutsummaryrefslogtreecommitdiffstats
path: root/qtip/cli/commands/cmd_plan.py
diff options
context:
space:
mode:
Diffstat (limited to 'qtip/cli/commands/cmd_plan.py')
-rw-r--r--qtip/cli/commands/cmd_plan.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/qtip/cli/commands/cmd_plan.py b/qtip/cli/commands/cmd_plan.py
index beb61b0e..b7c540b7 100644
--- a/qtip/cli/commands/cmd_plan.py
+++ b/qtip/cli/commands/cmd_plan.py
@@ -9,8 +9,11 @@
import click
+from colorama import Fore
import os
+from qtip.base.error import InvalidContentError
+from qtip.base.error import NotFoundError
from qtip.cli import utils
from qtip.cli.entry import Context
from qtip.loader.plan import Plan
@@ -44,10 +47,16 @@ def list(ctx):
@click.argument('name')
@pass_context
def show(ctx, name):
- plan = Plan('{}.yaml'.format(name))
- cnt = plan.content
- output = utils.render('plan', cnt)
- click.echo(output)
+ try:
+ plan = Plan('{}.yaml'.format(name))
+ except NotFoundError as nf:
+ click.echo(Fore.RED + "ERROR: plan spec: " + nf.message)
+ except InvalidContentError as ice:
+ click.echo(Fore.RED + "ERROR: plan spec: " + ice.message)
+ else:
+ cnt = plan.content
+ output = utils.render('plan', cnt)
+ click.echo(output)
@cli.command('run', help='Execute a Plan')