Commit 0c26c112 authored by Samuel GAIST's avatar Samuel GAIST

[commands] Factored all status commands to use common function

parent 3c408ca9
......@@ -337,6 +337,7 @@ algorithms.command(name="list")(commands.command("list"))
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()
......@@ -408,19 +409,6 @@ def diff(ctx, name):
)
@algorithms.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available algorithms
Example:
$ beat algorithms status
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return common.status(webapi, ctx.meta["config"].path, "algorithm")[0]
@algorithms.command()
@click.argument("name", nargs=-1)
@click.pass_context
......
......@@ -123,11 +123,26 @@ def check_impl(ctx, names):
return common.check(ctx.meta["config"].path, ctx.meta["asset_type"], names)
@click.pass_context
@raise_on_error
def status_impl(ctx):
"""Shows (editing) status for all available items of asset type
Example:
$ beat <asset_type> status
"""
config = ctx.meta["config"]
with common.make_webapi(config) as webapi:
return common.status(webapi, config.path, ctx.meta["asset_type"])[0]
CMD_TABLE = {
"list": list_impl,
"path": path_impl,
"edit": edit_impl,
"check": check_impl,
"status": status_impl,
}
......
......@@ -661,6 +661,7 @@ databases.command(name="list")(commands.command("list"))
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()
......@@ -740,16 +741,6 @@ def diff(ctx, db_names):
)
@databases.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available databases"""
configuration = ctx.meta["config"]
with common.make_webapi(configuration) as webapi:
return common.status(webapi, configuration.path, "database")[0]
@databases.command()
@click.argument("db_names", nargs=-1)
@click.pass_context
......
......@@ -144,6 +144,7 @@ dataformats.command(name="list")(commands.command("list"))
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()
......@@ -218,19 +219,6 @@ def diff(ctx, name):
)
@dataformats.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available dataformats
Example:
$ beat dataformats status
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return common.status(webapi, ctx.meta["config"].path, "dataformat")[0]
@dataformats.command()
@click.argument("names", nargs=-1)
@click.pass_context
......
......@@ -694,6 +694,7 @@ experiments.command(name="list")(commands.command("list"))
experiments.command(name="path")(commands.command("path"))
experiments.command(name="edit")(commands.command("edit"))
experiments.command(name="check")(commands.command("check"))
experiments.command(name="status")(commands.command("status"))
@experiments.command()
......@@ -810,20 +811,6 @@ def diff(ctx, name):
)
@experiments.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available experiments.
Example:
$ beat experiments status
"""
config = ctx.meta.get("config")
with common.make_webapi(config) as webapi:
return common.status(webapi, config.path, "experiment")[0]
@experiments.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
......
......@@ -177,6 +177,7 @@ libraries.command(name="list")(commands.command("list"))
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()
......@@ -248,19 +249,6 @@ def diff(ctx, name):
)
@libraries.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available libraries
Example:
$ beat libraries status
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return common.status(webapi, ctx.meta["config"].path, "library")[0]
@libraries.command()
@click.argument("names", nargs=-1)
@click.pass_context
......
......@@ -105,6 +105,7 @@ plotterparameters.command(name="list")(commands.command("list"))
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()
......
......@@ -321,6 +321,7 @@ plotters.command(name="list")(commands.command("list"))
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()
......
......@@ -62,6 +62,7 @@ protocoltemplates.command(name="list")(commands.command("list"))
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()
......
......@@ -55,6 +55,7 @@ toolchains.command(name="list")(commands.command("list"))
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()
......@@ -134,19 +135,6 @@ def diff(ctx, name):
)
@toolchains.command()
@click.pass_context
@raise_on_error
def status(ctx):
"""Shows (editing) status for all available toolchains
Example:
$ beat toolchains status
"""
with common.make_webapi(ctx.meta["config"]) as webapi:
return common.status(webapi, ctx.meta["config"].path, "toolchain")[0]
@toolchains.command()
@click.argument("names", 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