Commit 8cc48236 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[algo/cach/conf/db/df/exp/lib/plot/pp/scri/tool] Implement alies for

commands

Use AliasedGroup.
parent eae8b088
......@@ -34,11 +34,11 @@ import simplejson as json
from . import common
from .click_helper import AliasedGroup
from beat.core import algorithm
from beat.core.execution import DockerExecutor
from beat.core.dock import Host
from beat.core import hash
from beat.backend.python.database import Storage as DatabaseStorage
from beat.backend.python.algorithm import Storage as AlgorithmStorage
......@@ -288,7 +288,7 @@ def execute_impl(prefix, cache, instructions_file):
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def algorithms(ctx):
"""Configuration and manipulation of algorithms"""
......
......@@ -34,6 +34,7 @@ logger = logging.getLogger(__name__)
import simplejson
from . import common
from .click_helper import AliasedGroup
from beat.core.data import CachedDataSource, load_data_index
from beat.core.utils import NumpyJSONEncoder
......@@ -53,7 +54,7 @@ def get_paths(config):
return retval
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
@click.option('--start', type=click.INT, help='If set, allows the user to '
'print only a few bits of the file')
......
......@@ -33,7 +33,7 @@ import copy
import logging
import getpass
import click
from .scripts.click_helper import verbosity_option
from .scripts.click_helper import verbosity_option, AliasedGroup
import simplejson
logger = logging.getLogger(__name__)
......@@ -168,7 +168,7 @@ class Configuration(object):
return self.__data[key]
@click.group()
@click.group(cls=AliasedGroup)
@verbosity_option()
@click.pass_context
def config(ctx):
......
......@@ -37,6 +37,7 @@ import logging
import simplejson
from .click_helper import AliasedGroup
from beat.core.hash import toPath
from beat.core.hash import hashDataset
from beat.core.utils import NumpyJSONEncoder
......@@ -569,7 +570,7 @@ def view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None,
# ----------------------------------------------------------
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def databases(ctx):
"""Database commands"""
......
......@@ -30,6 +30,7 @@ import click
import oset
from .click_helper import AliasedGroup
from . import common
from beat.core import dataformat
......@@ -106,7 +107,7 @@ def pull_impl(webapi, prefix, names, force, indentation, cache):
# recurse until done
return pull_impl(webapi, prefix, dataformats, force, 2+indentation, cache)
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def dataformats(ctx):
"""Configuration manipulation of data formats"""
......
......@@ -36,6 +36,7 @@ import simplejson
from . import common
from .click_helper import AliasedGroup
from beat.core.experiment import Experiment
from beat.core.execution import DockerExecutor
from beat.core.execution import LocalExecutor
......@@ -45,8 +46,8 @@ from beat.core.dock import Host
from beat.core.hash import toPath
from beat.core.hash import hashDataset
from .plotters import plot as plotters_plot
from .plotters import pull as plotters_pull
from .plotters import plot_impl as plotters_plot
from .plotters import pull_impl as plotters_pull
logger = logging.getLogger(__name__)
......@@ -538,7 +539,7 @@ def plot_impl(webapi, configuration, prefix, names, remote_results, show, force,
return status
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def experiments(ctx):
"""experiments commands"""
......
......@@ -70,6 +70,7 @@ import click
import oset
from . import common
from .click_helper import AliasedGroup
from beat.core import library
logger = logging.getLogger(__name__)
......@@ -141,7 +142,7 @@ def pull_impl(webapi, prefix, names, force, indentation, cache):
return pull_impl(webapi, prefix, libraries, force, 2+indentation, cache)
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def libraries(ctx):
"""Configuration and manipulation of libraries"""
......@@ -194,38 +195,38 @@ def edit(ctx, name):
@libraries.command()
@click.argument('name', nargs=1)
@click.pass_context
def check(ctx, name):
def check(ctx, names):
'''Checks a local library for validity
Example:
$ beat libraries check xxx
'''
return common.check(ctx.meta['config'].path, 'library', name)
return common.check(ctx.meta['config'].path, 'library', names)
@libraries.command()
@click.argument('name', nargs=1)
@click.argument('names', nargs=-1)
@click.option('--force', help='Performs operation regardless of conflicts',
is_flag=True)
@click.pass_context
def pull(ctx, name, force):
def pull(ctx, names, force):
'''Downloads the specified libraries from the server
Example:
$ beat libraries pull --force yyy
'''
with common.make_webapi(ctx.meta['config']) as webapi:
return pull_impl(webapi, ctx.meta['config'].path, name, force, 0, {})
return pull_impl(webapi, ctx.meta['config'].path, names, force, 0, {})
@libraries.command()
@click.argument('name', nargs=1)
@click.argument('names', nargs=-1)
@click.option('--force', help='Performs operation regardless of conflicts',
is_flag=True)
@click.option('--dry-run', help="Doesn't really perform the task, just "
"comments what would do", is_flag=True)
@click.pass_context
def push(ctx, name, force, dry_run):
def push(ctx, names, force, dry_run):
'''Uploads libraries to the server
Example:
......@@ -233,7 +234,7 @@ def push(ctx, name, force, dry_run):
'''
with common.make_webapi(ctx.meta['config']) as webapi:
return common.push(webapi, ctx.meta['config'].path, 'library',
name, ['name', 'declaration', 'code', 'description'],
name, ['names', 'declaration', 'code', 'description'],
{}, force, dry_run, 0)
......@@ -264,15 +265,15 @@ def status(ctx):
@libraries.command()
@click.argument('name', nargs=1)
@click.argument('names', nargs=-1)
@click.pass_context
def create(ctx, name):
def create(ctx, names):
'''Creates a new local library
Example:
$ beat libraries create xxx
'''
return common.create(ctx.meta['config'].path, 'library', [name])
return common.create(ctx.meta['config'].path, 'library', name)
@libraries.command()
......@@ -300,11 +301,11 @@ def fork(ctx, src, dst):
@libraries.command()
@click.argument('name', nargs=1)
@click.argument('names', nargs=1)
@click.option('--remote', help='Only acts on the remote copy of the library',
is_flag=True)
@click.pass_context
def rm(ctx, name, remote):
def rm(ctx, names, remote):
'''Deletes a local library (unless --remote is specified)
Example:
......@@ -312,6 +313,6 @@ def rm(ctx, name, remote):
'''
if remote:
with common.make_webapi(ctx.meta['config']) as webapi:
return common.delete_remote(webapi, 'library', name)
return common.delete_remote(webapi, 'library', names)
else:
return common.delete_local(ctx.meta['config'].path, 'library', name)
return common.delete_local(ctx.meta['config'].path, 'library', names)
......@@ -29,6 +29,7 @@ import click
import simplejson
import collections
from .dataformats import pull as dataformats_pull
from .click_helper import AliasedGroup
import logging
logger = logging.getLogger(__name__)
......@@ -77,7 +78,7 @@ def pull_impl(webapi, prefix, names, force, indentation, format_cache):
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def plotterparameters(ctx):
"""Plotterparameters commands"""
......
......@@ -30,6 +30,7 @@ import sys
import click
import simplejson
import collections
from .click_helper import AliasedGroup
from .dataformats import pull_impl as dataformats_pull
from .plotterparameters import pull_impl as plotterparameters_pull
from .libraries import pull_impl as libraries_pull
......@@ -244,7 +245,7 @@ def plot_impl(webapi, prefix, names, show, force, need_data_sample, inputdata, o
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def plotters(ctx):
"""Plotters commands"""
......
......@@ -5,7 +5,7 @@ import logging
import pkg_resources
import click
from click_plugins import with_plugins
from .click_helper import verbosity_option
from .click_helper import verbosity_option, AliasedGroup
from ..config import Configuration
# defines our own logging level for extra information to be printed
......@@ -19,7 +19,7 @@ def _extra(self, message, *args, **kws):
logging.Logger.extra = _extra
@with_plugins(pkg_resources.iter_entry_points('beat.cli'))
@click.group()
@click.group(cls=AliasedGroup)
@click.option('-T', '--test-mode', help='Assume test mode and doesn\'t setup '
'the logging module', default=False, is_flag=True)
@click.option('-V', '--version', help='Show version', is_flag=True)
......
......@@ -27,9 +27,10 @@
import click
from . import common
from .click_helper import AliasedGroup
@click.group()
@click.group(cls=AliasedGroup)
@click.pass_context
def toolchains(ctx):
"""toolchains commands"""
......
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