How to use the click.option function in click

To help you get started, we’ve selected a few click examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pallets / click / tests / test_bashcomplete.py View on Github external
    @click.option('--bsub-opt', type=click.Choice(['bsubopt1', 'bsubopt2']))
    @click.argument('bsub-arg1', required=False, type=click.Choice(['bsubarg1', 'bsubarg2']))
    @click.argument('bbsub-arg2', required=False, type=click.Choice(['bbsubarg1', 'bbsubarg2']))
    def bsub(bsub_opt):
        pass
github frappe / bench / bench / commands / update.py View on Github external
@click.option('--requirements', is_flag=True, help="Update requirements")
@click.option('--restart-supervisor', is_flag=True, help="restart supervisor processes after update")
@click.option('--restart-systemd', is_flag=True, help="restart systemd units after update")
@click.option('--auto', is_flag=True)
@click.option('--no-backup', is_flag=True)
@click.option('--force', is_flag=True)
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, restart_systemd=False, requirements=False, no_backup=False, force=False, reset=False):
	"Update bench"

	if not is_bench_directory():
		"""Update only bench if bench update called from outside a bench"""
		update_bench(bench_repo=True, requirements=True)
		sys.exit()

	if not (pull or patch or build or bench or requirements):
		pull, patch, build, bench, requirements = True, True, True, True, True
github simonw / datasette / datasette / cli.py View on Github external
@click.option(
    "--template-dir",
    type=click.Path(exists=True, file_okay=False, dir_okay=True),
    help="Path to directory containing custom templates",
)
@click.option(
    "--plugins-dir",
    type=click.Path(exists=True, file_okay=False, dir_okay=True),
    help="Path to directory containing custom plugins",
)
@click.option(
    "--static",
    type=StaticMount(),
    help="Serve static files from this directory at /MOUNT/...",
    multiple=True,
)
@click.option("--memory", is_flag=True, help="Make :memory: database available")
github epfml / cola / run_cola.py View on Github external
@click.option('--dataset_path', default=None, help='Path to dataset')
@click.option('--graph_topology', type=str, help='Graph topology of the network.')
@click.option('--n_connectivity', type=int, help='Connected Cycle.')
@click.option('--l1_ratio', type=float, help='l1 ratio in the ElasticNet')
@click.option('--lambda_', type=float, help='Size of regularizer')
@click.option('--c', type=float, help='Constant in the LinearSVM.')
@click.option('--ckpt_freq', type=int, default=10, help='')
@click.option('--exit_time', default=1000.0, help='The maximum running time of a node.')
def main(dataset, dataset_path, dataset_size, use_split_dataset, split_by, random_state,
         algoritmname, max_global_steps, local_iters, solvername, output_dir, exit_time, lambda_, l1_ratio, theta,
         graph_topology, c, logmode, ckpt_freq, n_connectivity):

    # Fix gamma = 1.0 according to:
    #   Adding vs. Averaging in Distributed Primal-Dual Optimization
    gamma = 1.0

    # Initialize process group
github 21dotco / two1-python / two1 / commands / sell_file.py View on Github external
@click.option('--store')
@pass_config
def sell_file(config, file, price, store):
    """
    Upload file to sell to selected file store.
    """
    _sell_file(config, file, price, store)
github RunestoneInteractive / RunestoneServer / rsmanage / rsmanage.py View on Github external
@click.option(
    "--reset", is_flag=True, help="drop database and delete all migration information"
)
@click.option("--fake", is_flag=True, help="perform a fake migration")
@click.option("--force", is_flag=True, help="answer Yes to confirm questions")
@pass_config
def initdb(config, list_tables, reset, fake, force):
    """Initialize and optionally reset the database"""
    os.chdir(findProjectRoot())
    if not os.path.exists(DBSDIR):
        click.echo("Making databases folder")
        os.mkdir(DBSDIR)

    if not os.path.exists(PRIVATEDIR):
        click.echo("Making private directory for auth")
        os.mkdir(PRIVATEDIR)
github alanhamlett / pip-update-requirements / pur / __init__.py View on Github external
@click.option('-o', '--output', type=click.Path(),
              help='Output updated packages to this file; Defaults to ' +
              'overwriting the input requirements.txt file.')
@click.option('-i', '--interactive', is_flag=True, default=False,
              help='Interactively prompts before updating each package.')
@click.option('-f', '--force', is_flag=True, default=False,
              help='Force updating packages even when a package has no ' +
              'version specified in the input requirements.txt file.')
@click.option('-d', '--dry-run', is_flag=True, default=False,
              help='Output changes to STDOUT instead of overwriting the ' +
              'requirements.txt file.')
@click.option('-n', '--no-recursive', is_flag=True, default=False,
              help='Prevents updating nested requirements files.')
@click.option('-s', '--skip', type=click.STRING, help='Comma separated list ' +
              'of packages to skip updating.')
@click.option('--only', type=click.STRING, help='Comma separated list of ' +
              'packages. Only these packages will be updated.')
github dimitri / tpch-citus / tpch.py View on Github external
@click.option("--ini", default=CONF, type=click.Path(exists=True))
@click.option("--log", default=LOG_FILE, type=click.Path())
@click.option("--debug", is_flag=True, default=False)
@click.option("--detach", is_flag=True, default=False)
@click.option("--kind", default='pgsql')
@click.option("--schedule", default=SCHEDULE)
@click.option("--name")
@click.option("--dsn", envvar='DSN')
@click.argument('system')
def benchmark(system, name, schedule, kind, dsn, ini, log, debug, detach):
    """Run a benchmark schedule/job on SYSTEM"""
    name = name or utils.compose_name()
    conf = setup.Setup(ini)

    level = logging.INFO
    if debug:
        level = logging.DEBUG
github Azure / batch-shipyard / shipyard.py View on Github external
@click.option(
    '--generate-from-prefix', is_flag=True,
    help='Generate resources to delete from storage cluster hostname prefix')
@click.option(
    '--no-wait', is_flag=True, help='Do not wait for deletion to complete')
@common_options
@fs_cluster_options
@keyvault_options
@aad_options
@pass_cli_context
def fs_cluster_del(
        ctx, storage_cluster_id, delete_resource_group, delete_data_disks,
        delete_virtual_network, generate_from_prefix, no_wait):
    """Delete a filesystem storage cluster in Azure"""
    ctx.initialize_for_fs()
    convoy.fleet.action_fs_cluster_del(
        ctx.resource_client, ctx.compute_client, ctx.network_client,
github planetlabs / planet-client-python / planet / scripts / cli.py View on Github external
@click.option('-au', '--analytics-base-url',
              envvar='PL_ANALYTICS_API_BASE_URL',
              help=('Change the base Planet API URL or ENV '
                    'PL_ANALYTICS_API_BASE_URL'
                    ' - Default https://api.planet.com/analytics'))
@click.version_option(version=__version__, message='%(version)s')
def cli(context, verbose, api_key, base_url, analytics_base_url, workers):
    '''Planet API Client'''

    configure_logging(verbose)

    client_params.clear()
    client_params['api_key'] = api_key
    client_params['workers'] = workers
    if base_url:
        client_params['base_url'] = base_url
    if analytics_base_url: