Exemple #1
0
def _ac_flag_choices(incomplete, opdef):
    flag_name, flag_val_incomplete = incomplete.split("=", 1)
    flagdef = opdef.get_flagdef(flag_name)
    if not flagdef or (not flagdef.choices and _maybe_filename_type(flagdef)):
        return click_util.completion_filename()
    choices = _flagdef_choices(flagdef)
    return [val for val in choices if val.startswith(flag_val_incomplete)]
Exemple #2
0
def _ac_flag(incomplete, ctx, **_kw):
    if incomplete[:1] == "@":
        return _ac_batch_files()

    run_args = click_util.Args(**ctx.params)
    opdef = _ac_opdef(run_args.opspec)
    if not opdef:
        return []

    if "=" in incomplete:
        return (_ac_maybe_flag_choices(incomplete, opdef)
                or click_util.completion_filename())

    used_flags = _ac_used_flags(run_args.flags, opdef)
    unused_flags = sorted(
        [f.name for f in opdef.flags if f.name not in used_flags])
    flags_ac = [f for f in unused_flags if f.startswith(incomplete)]
    return ["%s=" % f for f in flags_ac] + click_util.completion_nospace()
def _ac_archive(**_kw):
    return click_util.completion_dir() + click_util.completion_filename(ext=["zip"])
Exemple #4
0
def _ac_all_tests(incomplete, ctx, **_kw):
    if ctx.params.get("remote"):
        return []
    return _ac_builtin_tests(
        incomplete, ctx) + click_util.completion_filename(ext=["md", "txt"])
Exemple #5
0
def _ac_opspec(incomplete, ctx, **_kw):
    ops = _ac_operations(incomplete, ctx)
    if not incomplete and ops:
        return ops
    return ops + click_util.completion_filename(ext=["py"])
Exemple #6
0
def _ac_opspec(incomplete, ctx, **_kw):
    ops = _ac_operations(incomplete, ctx)
    if not incomplete and ops:
        return ops
    return ops + click_util.completion_filename(AC_EXTENSIONS)
Exemple #7
0
def _ac_requirement(**_kw):
    return click_util.completion_filename(ext=["txt"])
Exemple #8
0
def _ac_guild_version_or_path(incomplete, ctx, **_kw):
    versions = [
        ver for ver in _guild_versions(ctx) if ver.startswith(incomplete)
    ]
    return versions + click_util.completion_filename(ext=["whl"])