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