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

[libraries] Use raise_on_error decorator for commands

parent 1010a8ca
......@@ -69,10 +69,13 @@ import logging
import click
import oset
from . import common
from beat.cmdline.scripts.click_helper import AliasedGroup
from beat.core import library
from . import common
from .decorators import raise_on_error
logger = logging.getLogger(__name__)
......@@ -153,6 +156,7 @@ def libraries(ctx):
@click.option('--remote', help='Only acts on the remote copy of the library',
is_flag=True)
@click.pass_context
@raise_on_error
def list(ctx, remote):
'''Lists all the libraries available on the platform
......@@ -169,6 +173,7 @@ def list(ctx, remote):
@libraries.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
'''Displays local path of libraries files
......@@ -181,6 +186,7 @@ def path(ctx, names):
@libraries.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def edit(ctx, name):
'''Edit local library file
......@@ -195,6 +201,7 @@ def edit(ctx, name):
@libraries.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def check(ctx, names):
'''Checks a local library for validity
......@@ -209,6 +216,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 libraries from the server
......@@ -226,6 +234,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 libraries to the server
......@@ -241,6 +250,7 @@ def push(ctx, names, force, dry_run):
@libraries.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def diff(ctx, name):
'''Shows changes between the local library and the remote version
......@@ -254,6 +264,7 @@ def diff(ctx, name):
@libraries.command()
@click.pass_context
@raise_on_error
def status(ctx):
'''Shows (editing) status for all available libraries
......@@ -267,6 +278,7 @@ def status(ctx):
@libraries.command()
@click.argument('names', nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
'''Creates a new local library
......@@ -279,6 +291,7 @@ def create(ctx, names):
@libraries.command()
@click.argument('name', nargs=1)
@click.pass_context
@raise_on_error
def version(ctx, name):
'''Creates a new version of an existing library
......@@ -291,6 +304,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 library
......@@ -305,6 +319,7 @@ def fork(ctx, src, dst):
@click.option('--remote', help='Only acts on the remote copy of the library',
is_flag=True)
@click.pass_context
@raise_on_error
def rm(ctx, names, remote):
'''Deletes a local library (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