Exemple #1
0
        for x in chain.from_iterable(it):
            yield x


# CLI


@click.group()
def cli():
    pass


@cli.command("list", help="List S3 objects")
@click.option(
    "--inputs",
    type=click.Path(exists=True),
    help="Read input prefixes from the given file.",
)
@click.option(
    "--num-workers",
    default=NUM_WORKERS_DEFAULT,
    show_default=True,
    help="Number of concurrent connections.",
)
@click.option(
    "--recursive/--no-recursive",
    default=False,
    show_default=True,
    help="Download prefixes recursively.",
)
@click.option(
Exemple #2
0
        echo('"%s"\n' % path, fg="cyan")
        for k, v in env_dict.items():
            echo("%s=%s" % (k, v))
    else:
        echo("Configuration is set to run locally.")


@configure.command(help="Export configuration to a file.")
@click.option(
    "--profile",
    "-p",
    default="",
    help="Optional named profile whose configuration must be "
    "exported.",
)
@click.argument("output_filename", type=click.Path(resolve_path=True))
def export(profile, output_filename):
    check_for_missing_profile(profile)
    # Export its contents to a new file.
    path = get_config_path(profile)
    env_dict = {}
    if os.path.exists(path):
        with open(path, "r") as f:
            env_dict = json.load(f)
    # resolve_path doesn't expand `~` in `path`.
    output_path = expanduser(output_filename)
    if os.path.exists(output_path):
        if click.confirm(
                "Do you wish to overwrite the contents in " +
                click.style('"%s"' % output_path, fg="cyan") + "?",
                abort=True,