How to use the click.version_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 UlordChain / Ulord-Sidechain-SDK / ucwallet / ucwallet_cli.py View on Github external
@click.version_option(__version__, '-v', '--version', is_flag=True, help="ucwallet版本信息")
@click.option('-logfile', type=click.Path(), help='日志文件位置(全路径)')
@click.option('--keystorefile', type=click.Path(), prompt='私钥文件位置(全路径)', help='私钥文件位置(全路径)')
@click.option('--keystore_pwd', prompt='私钥密码', help='私钥密码')
def cli(keystorefile, keystore_pwd, logfile):
    """ucwallet ---- ulord 侧链内容钱包"""
    # check keystorefile
    if not os.path.isfile(keystorefile):
        click.echo(click.style(
            'error keystorefile.',
            bg='red',
            bold=True
        ))
        sys.exit(-1)
    # 初始化CLI
    ucwallet = UCwallet(keystore_file=keystorefile, keystore_pwd=keystore_pwd)
    if logfile:
github matrix-org / pantalaimon / pantalaimon / panctl.py View on Github external
@click.version_option(version="0.4", prog_name="panctl")
def main():
    loop = asyncio.get_event_loop()
    glib_loop = GLib.MainLoop()

    try:
        panctl = PanCtl()
    except GLib.Error as e:
        print(f"Error, {e}")
        sys.exit(-1)

    fut = loop.run_in_executor(None, glib_loop.run)

    try:
        loop.run_until_complete(panctl.loop())
    except KeyboardInterrupt:
        pass
github datawire / kubernaut / kubernaut / cli.py View on Github external
@click.version_option(version=__version__, prog_name="kubernaut")
def cli(ctx: Context, kubernaut_backend: Optional[str], kubernaut_config: str):
    config = Config.load(Path(kubernaut_config))
    app_ctx = KubernautContext(config)

    if kubernaut_backend:
        config.current_backend = kubernaut_backend

    ctx.obj = app_ctx
github packit-service / packit / packit / cli / packit_base.py View on Github external
@click.version_option(
    version=get_distribution("packitos").version, message="%(version)s"
)
@click.pass_context
def packit_base(ctx, debug, fas_user, keytab, dry_run):
    """Integrate upstream open source projects into Fedora operating system."""
    if debug:
        # to be able to logger.debug() also in get_user_config()
        set_logging(level=logging.DEBUG)

    c = Config.get_user_config()
    c.debug = debug or c.debug
    c.dry_run = dry_run or c.dry_run
    c.fas_user = fas_user or c.fas_user
    c.keytab_path = keytab or c.keytab_path
    ctx.obj = c
github lektor / lektor-archive / lektor / cli.py View on Github external
@click.version_option(prog_name='Lektor', version=version)
@pass_context
def cli(ctx, project=None, language=None):
    """The lektor management application.

    This command can invoke lektor locally and serve up the website.  It's
    intended for local development of websites.
    """
    if language is not None:
        ctx.ui_lang = language
    if project is not None:
        ctx.set_project_path(project)
github DHI-GRAS / terracotta / terracotta / scripts / cli.py View on Github external
@click.version_option(version=__version__)
@click.pass_context
def cli(ctx: click.Context,
        config: Mapping[str, Any] = None,
        loglevel: str = None) -> None:
    """The command line interface for the Terracotta tile server.

    All flags must be passed before specifying a subcommand.

    Example:

        $ terracotta -c config.toml connect localhost:5000

    """
    if ctx.invoked_subcommand is None:
        click.echo(ctx.get_help())
github pypa / pipenv / pipenv / cli.py View on Github external
@version_option(prog_name=crayons.normal("pipenv", bold=True), version=__version__)
@pass_context
def cli(
    ctx,
    where=False,
    venv=False,
    rm=False,
    bare=False,
    three=False,
    python=False,
    help=False,
    py=False,
    site_packages=False,
    envs=False,
    man=False,
    completion=False,
    pypi_mirror=None,
github idlesign / vininfo / vininfo / cli.py View on Github external
@click.version_option(version=VERSION_STR)
def entry_point():
    """vininfo command line utilities."""
github thebigmunch / google-music-scripts / src / google_music_scripts / commands / download.py View on Github external
@click.version_option(
	__version__,
	'-V', '--version',
	prog_name=__title__,
	message="%(prog)s %(version)s"
)
@click.option(
	'-l', '--log',
	is_flag=True,
	default=False,
	help="Log to file."
)
@click.option(
	'-v', '--verbose',
	count=True
)
@click.option(
github gWOLF3 / moter / moter.py View on Github external
@click.version_option(version=subprocess.getoutput("brew cask list --versions moter"))
@click.group()
def cli():
    pass