Commit 83834501 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[toolchains] Use raise_on_error decorator for commands

parent 48cd5c83
......@@ -26,9 +26,12 @@
###############################################################################
import click
from . import common
from beat.cmdline.scripts.click_helper import AliasedGroup
from . import common
from .decorators import raise_on_error
@click.group(cls=AliasedGroup)
@click.pass_context
......@@ -42,6 +45,7 @@ def toolchains(ctx):
@click.option('--remote', help='Only acts on the remote copy of the list.',
is_flag=True)
@click.pass_context
@raise_on_error
def list(ctx, remote):
'''Lists all the toolchains available on the platform.
......@@ -59,6 +63,7 @@ def list(ctx, remote):
@toolchains.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
'''Displays local path of toolchain files
......@@ -71,6 +76,7 @@ def path(ctx, names):
@toolchains.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def edit(ctx, name):
'''Edit local toolchain file
......@@ -85,6 +91,7 @@ def edit(ctx, name):
@toolchains.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def check(ctx, names):
'''Checks a local toolchain for validity.
......@@ -99,6 +106,7 @@ def check(ctx, names):
@click.option('--force', help='Performs operation regardless of conflicts',
is_flag=True)
@click.pass_context
@raise_on_error
def pull(ctx, names, force):
'''Downloads the specified toolchains from the server.
......@@ -119,6 +127,7 @@ def pull(ctx, names, force):
@click.option('--dry-run', help="Doesn't really perform the task, just "
"comments what would do", is_flag=True)
@click.pass_context
@raise_on_error
def push(ctx, names, force, dry_run):
'''Uploads toolchains to the server
......@@ -136,6 +145,7 @@ def push(ctx, names, force, dry_run):
@toolchains.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def diff(ctx, name):
'''Shows changes between the local dataformat and the remote version
......@@ -150,6 +160,7 @@ def diff(ctx, name):
@toolchains.command()
@click.pass_context
@raise_on_error
def status(ctx):
'''Shows (editing) status for all available toolchains
......@@ -164,6 +175,7 @@ def status(ctx):
@toolchains.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
'''Creates a new local toolchain.
......@@ -176,6 +188,7 @@ def create(ctx, names):
@toolchains.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def version(ctx, name):
'''Creates a new version of an existing toolchain.
......@@ -189,6 +202,7 @@ def version(ctx, name):
@click.argument('src', nargs=1)
@click.argument('dst', nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
'''Forks a local toolchain.
......@@ -203,6 +217,7 @@ def fork(ctx, src, dst):
@click.option('--remote', help='Only acts on the remote copy.',
is_flag=True)
@click.pass_context
@raise_on_error
def rm(ctx, names, remote):
'''Deletes a local toolchain (unless --remote is specified).
......@@ -221,6 +236,7 @@ def rm(ctx, names, remote):
@click.option('--path', help='Use path to write files to disk (instead of the '
'current directory)', type=click.Path())
@click.pass_context
@raise_on_error
def draw(ctx, names, path):
'''Creates a visual representation of the toolchain'''
return common.dot_diagram(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment