Commit bf4ac376 authored by Samuel GAIST's avatar Samuel GAIST

[commands] Factored all fork commands to use common function

parent 5ab3e5f5
......@@ -340,6 +340,7 @@ algorithms.command(name="check")(commands.command("check"))
algorithms.command(name="status")(commands.command("status"))
algorithms.command(name="create")(commands.command("create"))
algorithms.command(name="version")(commands.command("version"))
algorithms.command(name="fork")(commands.command("fork"))
@algorithms.command()
......@@ -411,20 +412,6 @@ def diff(ctx, name):
)
@algorithms.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
"""Forks a local algorithm
Example:
$ beat algorithms fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "algorithm", src, dst)
@algorithms.command()
@click.argument("name", nargs=-1)
@click.option(
......
......@@ -163,6 +163,20 @@ def version_impl(ctx, name):
return common.new_version(ctx.meta["config"].path, ctx.meta["asset_type"], name)
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork_impl(ctx, src, dst):
"""Forks a local asset
Example:
$ beat <asset_type> fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, ctx.meta["asset_type"], src, dst)
CMD_TABLE = {
"list": list_impl,
"path": path_impl,
......@@ -171,6 +185,7 @@ CMD_TABLE = {
"status": status_impl,
"create": create_impl,
"version": version_impl,
"fork": fork_impl,
}
......
......@@ -147,6 +147,7 @@ dataformats.command(name="check")(commands.command("check"))
dataformats.command(name="status")(commands.command("status"))
dataformats.command(name="create")(commands.command("create"))
dataformats.command(name="version")(commands.command("version"))
dataformats.command(name="fork")(commands.command("fork"))
@dataformats.command()
......@@ -221,20 +222,6 @@ def diff(ctx, name):
)
@dataformats.command()
@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
Example:
$ beat dataformats fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "dataformat", src, dst)
@dataformats.command()
@click.argument("name", nargs=-1)
@click.option(
......
......@@ -695,6 +695,7 @@ 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(name="fork")(commands.command("fork"))
@experiments.command()
......@@ -811,20 +812,6 @@ def diff(ctx, name):
)
@experiments.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
"""Forks a local experiment.
$ beat experiments fork xxx yyy
"""
config = ctx.meta.get("config")
return common.fork(config.path, "experiment", src, dst)
@experiments.command()
@click.argument("names", nargs=-1)
@click.option(
......
......@@ -180,6 +180,7 @@ libraries.command(name="check")(commands.command("check"))
libraries.command(name="status")(commands.command("status"))
libraries.command(name="create")(commands.command("create"))
libraries.command(name="version")(commands.command("version"))
libraries.command(name="fork")(commands.command("fork"))
@libraries.command()
......@@ -251,20 +252,6 @@ def diff(ctx, name):
)
@libraries.command()
@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
Example:
$ beat libraries fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "library", src, dst)
@libraries.command()
@click.argument("names", nargs=1)
@click.option(
......
......@@ -108,6 +108,7 @@ plotterparameters.command(name="check")(commands.command("check"))
plotterparameters.command(name="status")(commands.command("status"))
plotterparameters.command(name="create")(commands.command("create"))
plotterparameters.command(name="version")(commands.command("version"))
plotterparameters.command(name="fork")(commands.command("fork"))
@plotterparameters.command()
......@@ -127,19 +128,6 @@ def pull(ctx, names, force):
return pull_impl(webapi, ctx.meta["config"].path, name, force, 0, {})
@plotterparameters.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
"""Forks a local plotter.
$ beat plotterparameters fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "plotterparameter", src, dst)
@plotterparameters.command()
@click.argument("names", nargs=-1)
@click.pass_context
......
......@@ -324,6 +324,7 @@ plotters.command(name="check")(commands.command("check"))
plotters.command(name="status")(commands.command("status"))
plotters.command(name="create")(commands.command("create"))
plotters.command(name="version")(commands.command("version"))
plotters.command(name="fork")(commands.command("fork"))
@plotters.command()
......@@ -381,19 +382,6 @@ def plot(
)
@plotters.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
"""Forks a local plotter.
$ beat plotters fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "plotter", src, dst)
@plotters.command()
@click.argument("names", nargs=-1)
@click.pass_context
......
......@@ -63,3 +63,4 @@ protocoltemplates.command(name="check")(commands.command("check"))
protocoltemplates.command(name="status")(commands.command("status"))
protocoltemplates.command(name="create")(commands.command("create"))
protocoltemplates.command(name="version")(commands.command("version"))
protocoltemplates.command(name="fork")(commands.command("fork"))
......@@ -58,6 +58,7 @@ toolchains.command(name="check")(commands.command("check"))
toolchains.command(name="status")(commands.command("status"))
toolchains.command(name="create")(commands.command("create"))
toolchains.command(name="version")(commands.command("version"))
toolchains.command(name="fork")(commands.command("fork"))
@toolchains.command()
......@@ -137,19 +138,6 @@ def diff(ctx, name):
)
@toolchains.command()
@click.argument("src", nargs=1)
@click.argument("dst", nargs=1)
@click.pass_context
@raise_on_error
def fork(ctx, src, dst):
"""Forks a local toolchain.
$ beat toolchains fork xxx yyy
"""
return common.fork(ctx.meta["config"].path, "toolchain", src, dst)
@toolchains.command()
@click.argument("names", nargs=-1)
@click.option("--remote", help="Only acts on the remote copy.", is_flag=True)
......
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