Commit 548b1339 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[dataformats] Use raise_on_error decorator for commands

parent 54b35572
......@@ -30,13 +30,16 @@ import click
import oset
from beat.core import dataformat
from beat.cmdline.scripts.click_helper import AliasedGroup
from . import common
from beat.core import dataformat
from . import common
from .decorators import raise_on_error
LOGGER = logging.getLogger(__name__)
def pull_impl(webapi, prefix, names, force, indentation, cache):
"""Copies dataformats (recursively) from the server.
......@@ -118,6 +121,7 @@ def dataformats(ctx):
@click.option('--remote', help='Only acts on the remote copy of the dataformat',
is_flag=True)
@click.pass_context
@raise_on_error
def list(ctx, remote):
'''Lists all the dataformats available on the platform
......@@ -134,6 +138,7 @@ def list(ctx, remote):
@dataformats.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
'''Displays local path of dataformats files
......@@ -146,6 +151,7 @@ def path(ctx, names):
@dataformats.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def edit(ctx, name):
'''Edit local dataformat file
......@@ -160,6 +166,7 @@ def edit(ctx, name):
@dataformats.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def check(ctx, names):
'''Checks a local dataformat for validity
......@@ -174,6 +181,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, name, force):
'''Downloads the specified dataformats from the server
......@@ -194,6 +202,7 @@ def pull(ctx, name, 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, name, force, dry_run):
'''Uploads dataformats to the server
......@@ -211,6 +220,7 @@ def push(ctx, name, force, dry_run):
@dataformats.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
......@@ -224,6 +234,7 @@ def diff(ctx, name):
@dataformats.command()
@click.pass_context
@raise_on_error
def status(ctx):
'''Shows (editing) status for all available dataformats
......@@ -237,6 +248,7 @@ def status(ctx):
@dataformats.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
'''Creates a new local dataformat
......@@ -249,6 +261,7 @@ def create(ctx, names):
@dataformats.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def version(ctx, name):
'''Creates a new version of an existing dataformat
......@@ -262,6 +275,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 dataformat
......@@ -276,6 +290,7 @@ def fork(ctx, src, dst):
@click.option('--remote', help='Only acts on the remote copy of the dataformat',
is_flag=True)
@click.pass_context
@raise_on_error
def rm(ctx, name, remote):
'''Deletes a local dataformat (unless --remote is specified)
......
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