Commit 852e120a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[plotterparameters] Use raise_on_error decorator for commands

parent d2c611a6
...@@ -26,16 +26,18 @@ ...@@ -26,16 +26,18 @@
############################################################################### ###############################################################################
import click import click
import simplejson
import collections
from .dataformats import pull as dataformats_pull
from beat.cmdline.scripts.click_helper import AliasedGroup
import logging import logging
logger = logging.getLogger(__name__)
from beat.cmdline.scripts.click_helper import AliasedGroup
from . import common from . import common
from .decorators import raise_on_error
logger = logging.getLogger(__name__)
def pull_impl(webapi, prefix, names, force, indentation, format_cache): def pull_impl(webapi, prefix, names, force, indentation, format_cache):
"""Copies plotterparameters from the server. """Copies plotterparameters from the server.
...@@ -90,6 +92,7 @@ def plotterparameters(ctx): ...@@ -90,6 +92,7 @@ def plotterparameters(ctx):
@click.option('--remote', help='Only acts on the remote copy of the list.', @click.option('--remote', help='Only acts on the remote copy of the list.',
is_flag=True) is_flag=True)
@click.pass_context @click.pass_context
@raise_on_error
def list(ctx, remote): def list(ctx, remote):
'''Lists all the plotterparameters available on the platform. '''Lists all the plotterparameters available on the platform.
...@@ -107,6 +110,7 @@ def list(ctx, remote): ...@@ -107,6 +110,7 @@ def list(ctx, remote):
@plotterparameters.command() @plotterparameters.command()
@click.argument('names', nargs=-1) @click.argument('names', nargs=-1)
@click.pass_context @click.pass_context
@raise_on_error
def path(ctx, names): def path(ctx, names):
'''Displays local path of plotterparameter files '''Displays local path of plotterparameter files
...@@ -119,6 +123,7 @@ def path(ctx, names): ...@@ -119,6 +123,7 @@ def path(ctx, names):
@plotterparameters.command() @plotterparameters.command()
@click.argument('name', nargs=1) @click.argument('name', nargs=1)
@click.pass_context @click.pass_context
@raise_on_error
def edit(ctx, name): def edit(ctx, name):
'''Edit local plotterparameter file '''Edit local plotterparameter file
...@@ -133,6 +138,7 @@ def edit(ctx, name): ...@@ -133,6 +138,7 @@ def edit(ctx, name):
@plotterparameters.command() @plotterparameters.command()
@click.argument('names', nargs=-1) @click.argument('names', nargs=-1)
@click.pass_context @click.pass_context
@raise_on_error
def check(ctx, names): def check(ctx, names):
'''Checks a local plotter for validity. '''Checks a local plotter for validity.
...@@ -147,6 +153,7 @@ def check(ctx, names): ...@@ -147,6 +153,7 @@ def check(ctx, names):
@click.option('--force', help='Force', @click.option('--force', help='Force',
is_flag=True) is_flag=True)
@click.pass_context @click.pass_context
@raise_on_error
def pull(ctx, names, force): def pull(ctx, names, force):
'''Downloads the specified plotterparameters from the server. '''Downloads the specified plotterparameters from the server.
...@@ -163,6 +170,7 @@ def pull(ctx, names, force): ...@@ -163,6 +170,7 @@ def pull(ctx, names, force):
@plotterparameters.command() @plotterparameters.command()
@click.argument('names', nargs=-1) @click.argument('names', nargs=-1)
@click.pass_context @click.pass_context
@raise_on_error
def create(ctx, names): def create(ctx, names):
'''Creates a new local plotter. '''Creates a new local plotter.
...@@ -175,6 +183,7 @@ def create(ctx, names): ...@@ -175,6 +183,7 @@ def create(ctx, names):
@plotterparameters.command() @plotterparameters.command()
@click.argument('name', nargs=1) @click.argument('name', nargs=1)
@click.pass_context @click.pass_context
@raise_on_error
def version(ctx, name): def version(ctx, name):
'''Creates a new version of an existing plotter. '''Creates a new version of an existing plotter.
...@@ -187,6 +196,7 @@ def version(ctx, name): ...@@ -187,6 +196,7 @@ def version(ctx, name):
@click.argument('src', nargs=1) @click.argument('src', nargs=1)
@click.argument('dst', nargs=1) @click.argument('dst', nargs=1)
@click.pass_context @click.pass_context
@raise_on_error
def fork(ctx, src, dst): def fork(ctx, src, dst):
'''Forks a local plotter. '''Forks a local plotter.
...@@ -199,6 +209,7 @@ def fork(ctx, src, dst): ...@@ -199,6 +209,7 @@ def fork(ctx, src, dst):
@plotterparameters.command() @plotterparameters.command()
@click.argument('names', nargs=-1) @click.argument('names', nargs=-1)
@click.pass_context @click.pass_context
@raise_on_error
def rm(ctx, names): def rm(ctx, names):
'''Deletes a local plotter. '''Deletes a local plotter.
......
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