Commit f00169c6 authored by Samuel GAIST's avatar Samuel GAIST

[commands] Factored all path commands to use common function

parent 8161c5b9
......@@ -334,19 +334,7 @@ def algorithms(ctx):
algorithms.command(name="list")(commands.command("list"))
@algorithms.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of algorithm files
Example:
$ beat algorithms path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "algorithm", names)
algorithms.command(name="path")(commands.command("path"))
@algorithms.command()
......
......@@ -80,7 +80,21 @@ def list_impl(ctx, remote):
)
CMD_TABLE = {"list": list_impl}
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path_impl(ctx, names):
"""Displays local path of asset files
Example:
$ beat <asset_type> path xxx
"""
return common.display_local_path(
ctx.meta["config"].path, ctx.meta["asset_type"], names
)
CMD_TABLE = {"list": list_impl, "path": path_impl}
def command(name):
......
......@@ -658,19 +658,7 @@ def databases(ctx):
databases.command(name="list")(commands.command("list"))
@databases.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of databases files
Example:
$ beat databases path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "database", names)
databases.command(name="path")(commands.command("path"))
@databases.command()
......
......@@ -141,19 +141,7 @@ def dataformats(ctx):
dataformats.command(name="list")(commands.command("list"))
@dataformats.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of dataformats files
Example:
$ beat dataformats path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "dataformat", names)
dataformats.command(name="path")(commands.command("path"))
@dataformats.command()
......
......@@ -691,6 +691,7 @@ def experiments(ctx):
experiments.command(name="list")(commands.command("list"))
experiments.command(name="path")(commands.command("path"))
@experiments.command()
......@@ -740,19 +741,6 @@ def caches(ctx, name, list, delete, checksum):
return caches_impl(config, name, list, delete, checksum)
@experiments.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of experiment files
Example:
$ beat experiments path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "experiment", names)
@experiments.command()
@click.argument("name", nargs=1)
@click.pass_context
......
......@@ -174,19 +174,7 @@ def libraries(ctx):
libraries.command(name="list")(commands.command("list"))
@libraries.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of libraries files
Example:
$ beat libraries path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "library", names)
libraries.command(name="path")(commands.command("path"))
@libraries.command()
......
......@@ -102,19 +102,7 @@ def plotterparameters(ctx):
plotterparameters.command(name="list")(commands.command("list"))
@plotterparameters.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of plotterparameter files
Example:
$ beat plotterparameters path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "plotterparameter", names)
plotterparameters.command(name="path")(commands.command("path"))
@plotterparameters.command()
......
......@@ -318,19 +318,7 @@ def plotters(ctx):
plotters.command(name="list")(commands.command("list"))
@plotters.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of plotters files
Example:
$ beat plotters path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "plotter", names)
plotters.command(name="path")(commands.command("path"))
@plotters.command()
......
......@@ -59,19 +59,7 @@ def protocoltemplates(ctx):
protocoltemplates.command(name="list")(commands.command("list"))
@protocoltemplates.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of databases files
Example:
$ beat databases path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "protocoltemplate", names)
protocoltemplates.command(name="path")(commands.command("path"))
@protocoltemplates.command()
......
......@@ -52,19 +52,7 @@ def toolchains(ctx):
toolchains.command(name="list")(commands.command("list"))
@toolchains.command()
@click.argument("names", nargs=-1)
@click.pass_context
@raise_on_error
def path(ctx, names):
"""Displays local path of toolchain files
Example:
$ beat toolchains path xxx
"""
return common.display_local_path(ctx.meta["config"].path, "toolchain", names)
toolchains.command(name="path")(commands.command("path"))
@toolchains.command()
......
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