Example #1
0
 def wrapper(*args, **kwargs):
     ctx_obj = get_current_context().obj
     path = ctx_obj["cvc_local_path"]
     conservator = Conservator.create(ctx_obj["config_name"])
     # raises InvalidLocalDatasetPath if the path does not point to a
     # valid LocalDataset (defined as a directory containing index.json).
     local_dataset = LocalDataset(conservator, path)
     return func(local_dataset, *args, **kwargs)
Example #2
0
 def upload(localpath, remote_collection, remote_name,
            create_collections):
     ctx_obj = click.get_current_context().obj
     conservator = Conservator.create(ctx_obj["config_name"])
     if create_collections:
         collection = conservator.collections.from_remote_path(
             path=remote_collection, make_if_no_exist=True, fields="id")
     else:
         collection = conservator.collections.from_string(
             remote_collection, fields="id")
     conservator.media.upload(localpath,
                              collection=collection,
                              remote_name=remote_name)
     return True
Example #3
0
def interactive():
    global conservator
    ctx_obj = click.get_current_context().obj
    conservator = Conservator.create(ctx_obj["config_name"])

    click.secho(
        """This is an interactive conservator "shell" that simulates the directory\n"""
        """structure of Conservator's collections. Type "help" to see available commands.""",
        fg="cyan",
    )

    domain = conservator.get_domain()

    click.secho(f"Loading identity from {domain}...", fg="yellow")
    username = conservator.get_user().name
    get_root_collections()

    while True:
        user = click.style(f"{username}@{domain}:", fg="magenta", bold=True)
        path = click.style(f"{pwd}", fg="blue", bold=True)
        end = click.unstyle("$ ")
        command = input(user + path + end)
        run_shell_command(command)
Example #4
0
def whoami():
    ctx_obj = click.get_current_context().obj
    conservator = Conservator.create(ctx_obj["config_name"])
    user = conservator.get_user()
    click.echo(to_clean_string(user))
Example #5
0
 def get_instance():
     ctx_obj = click.get_current_context().obj
     conservator = Conservator.create(ctx_obj["config_name"])
     return type_manager(conservator)
Example #6
0
def clone(ctx, identifier, path, checkout):
    conservator = Conservator.create(ctx.obj["config_name"])
    dataset = conservator.datasets.from_string(identifier)
    cloned = LocalDataset.clone(dataset, path)
    if checkout is not None:
        cloned.checkout(checkout)