本文整理汇总了Python中click_completion.init方法的典型用法代码示例。如果您正苦于以下问题:Python click_completion.init方法的具体用法?Python click_completion.init怎么用?Python click_completion.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类click_completion
的用法示例。
在下文中一共展示了click_completion.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cli
# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def cli(ctx, path, external_storage_requested):
"""Check common Renku commands used in various situations."""
renku_path = Path(path) / RENKU_HOME
if not renku_path.exists() and not is_allowed_command(ctx):
raise UsageError((
'`{0}` is not a renku repository.\n'
'To initialize this as a renku '
'repository use: `renku init`'.format(path)
))
ctx.obj = LocalClient(
path=path,
external_storage_requested=external_storage_requested,
)
if (
path != os.getcwd() and
ctx.invoked_subcommand not in WARNING_UNPROTECTED_COMMANDS
):
click.secho(
WARNING +
'Run CLI commands only from project\'s root directory.\n',
err=True
)
示例2: init
# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def init():
"""Initializes the dsl for basic configs and bp directory etc."""
pass
示例3: main
# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def main(args=None):
global main_shell
set_logger()
click_completion.init()
ctx = click.Context(grpc_shell)
try:
load_config_fc(ctx, sys.argv[1])
except IndexError:
load_config_fc(ctx)
ctx.obj = dict()
main_shell = make_click_shell(ctx, prompt=default_prompt, intro='Starting grpc shell', hist_file=os.path.join(home,'.grpc_shell.history'))
if startup_config:
exec_config_fc(startup_config)
main_shell.cmdloop()
示例4: run_with_conda_env
# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def run_with_conda_env(bundle_path, command):
config = load_saved_bundle_config(bundle_path)
metadata = config['metadata']
env_name = metadata['service_name'] + '_' + metadata['service_version']
yaml = YAML()
yaml.default_flow_style = False
tmpf = tempfile.NamedTemporaryFile(delete=False)
env_path = tmpf.name + '.yaml'
yaml.dump(config['env']['conda_env'], Path(env_path))
pip_req = os.path.join(bundle_path, 'requirements.txt')
subprocess.call(
'command -v conda >/dev/null 2>&1 || {{ echo >&2 "--with-conda '
'parameter requires conda but it\'s not installed."; exit 1; }} && '
'conda env update -n {env_name} -f {env_file} && '
'conda init bash && '
'eval "$(conda shell.bash hook)" && '
'conda activate {env_name} && '
'{{ [ -f {pip_req} ] && pip install -r {pip_req} || echo "no pip '
'dependencies."; }} && {cmd}'.format(
env_name=env_name, env_file=env_path, pip_req=pip_req, cmd=command,
),
shell=True,
)
return