Commit 1baa7f51 authored by Samuel GAIST's avatar Samuel GAIST

[commands] Factored all create commands to use common function

parent 0c26c112
......@@ -338,6 +338,7 @@ algorithms.command(name="path")(commands.command("path"))
algorithms.command(name="edit")(commands.command("edit"))
algorithms.command(name="check")(commands.command("check"))
algorithms.command(name="status")(commands.command("status"))
algorithms.command(name="create")(commands.command("create"))
@algorithms.command()
......@@ -409,19 +410,6 @@ def diff(ctx, name):
)
@algorithms.command()
@click.argument("name", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, name):
"""Creates a new local algorithm
Example:
$ beat algorithms create xxx
"""
return common.create(ctx.meta["config"].path, "algorithm", name)
@algorithms.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -137,12 +137,26 @@ def status_impl(ctx):
return common.status(webapi, config.path, ctx.meta["asset_type"])[0]
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create_impl(ctx, names):
"""Creates a new local asset.
Example:
$ beat <asset_type> create xxx
"""
return common.create(ctx.meta["config"].path, ctx.meta["asset_type"], names)
CMD_TABLE = {
"list": list_impl,
"path": path_impl,
"edit": edit_impl,
"check": check_impl,
"status": status_impl,
"create": create_impl,
}
......
......@@ -662,6 +662,7 @@ databases.command(name="path")(commands.command("path"))
databases.command(name="edit")(commands.command("edit"))
databases.command(name="check")(commands.command("check"))
databases.command(name="status")(commands.command("status"))
databases.command(name="create")(commands.command("create"))
@databases.command()
......
......@@ -145,6 +145,7 @@ dataformats.command(name="path")(commands.command("path"))
dataformats.command(name="edit")(commands.command("edit"))
dataformats.command(name="check")(commands.command("check"))
dataformats.command(name="status")(commands.command("status"))
dataformats.command(name="create")(commands.command("create"))
@dataformats.command()
......@@ -219,19 +220,6 @@ def diff(ctx, name):
)
@dataformats.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
"""Creates a new local dataformat
Example:
$ beat dataformats create xxx
"""
return common.create(ctx.meta["config"].path, "dataformat", names)
@dataformats.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -178,6 +178,7 @@ libraries.command(name="path")(commands.command("path"))
libraries.command(name="edit")(commands.command("edit"))
libraries.command(name="check")(commands.command("check"))
libraries.command(name="status")(commands.command("status"))
libraries.command(name="create")(commands.command("create"))
@libraries.command()
......@@ -249,19 +250,6 @@ def diff(ctx, name):
)
@libraries.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
"""Creates a new local library
Example:
$ beat libraries create xxx
"""
return common.create(ctx.meta["config"].path, "library", names)
@libraries.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -106,6 +106,7 @@ plotterparameters.command(name="path")(commands.command("path"))
plotterparameters.command(name="edit")(commands.command("edit"))
plotterparameters.command(name="check")(commands.command("check"))
plotterparameters.command(name="status")(commands.command("status"))
plotterparameters.command(name="create")(commands.command("create"))
@plotterparameters.command()
......@@ -125,18 +126,6 @@ def pull(ctx, names, force):
return pull_impl(webapi, ctx.meta["config"].path, name, force, 0, {})
@plotterparameters.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
"""Creates a new local plotter.
$ beat plotterparameters create xxx
"""
return common.create(ctx.meta["config"].path, "plotterparameter", names)
@plotterparameters.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -322,6 +322,7 @@ plotters.command(name="path")(commands.command("path"))
plotters.command(name="edit")(commands.command("edit"))
plotters.command(name="check")(commands.command("check"))
plotters.command(name="status")(commands.command("status"))
plotters.command(name="create")(commands.command("create"))
@plotters.command()
......@@ -379,18 +380,6 @@ def plot(
)
@plotters.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
"""Creates a new local plotter.
$ beat plotters create xxx
"""
return common.create(ctx.meta["config"].path, "plotter", names)
@plotters.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -63,6 +63,7 @@ protocoltemplates.command(name="path")(commands.command("path"))
protocoltemplates.command(name="edit")(commands.command("edit"))
protocoltemplates.command(name="check")(commands.command("check"))
protocoltemplates.command(name="status")(commands.command("status"))
protocoltemplates.command(name="create")(commands.command("create"))
@protocoltemplates.command()
......
......@@ -56,6 +56,7 @@ toolchains.command(name="path")(commands.command("path"))
toolchains.command(name="edit")(commands.command("edit"))
toolchains.command(name="check")(commands.command("check"))
toolchains.command(name="status")(commands.command("status"))
toolchains.command(name="create")(commands.command("create"))
@toolchains.command()
......@@ -135,18 +136,6 @@ def diff(ctx, name):
)
@toolchains.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def create(ctx, names):
"""Creates a new local toolchain.
$ beat toolchains create xxx
"""
return common.create(ctx.meta["config"].path, "toolchain", names)
@toolchains.command()
@click.argument("name", nargs=1)
@click.pass_context
......
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