Beispiel #1
0
def complete_cd(prefix, line, start, end, ctx):
    """
    Completion for "cd", includes only valid directory names.
    """
    if start != 0 and line.split(" ")[0] == "cd":
        return complete_dir(prefix, line, start, end, ctx, True)
    return set()
Beispiel #2
0
def complete_cd(prefix, line, start, end, ctx):
    """
    Completion for "cd", includes only valid directory names.
    """
    if start != 0 and line.split(' ')[0] == 'cd':
        return complete_dir(prefix, line, start, end, ctx, True)
    return set()
Beispiel #3
0
def venv_names_completer(command, alias: "VoxHandler", **_):
    envs = alias.vox.keys()
    from xonsh.completers.path import complete_dir

    yield from envs

    paths, _ = complete_dir(command)
    yield from paths
Beispiel #4
0
def complete_cd(command: CommandContext):
    """
    Completion for "cd", includes only valid directory names.
    """
    results, lprefix = complete_dir(command)
    if len(results) == 0:
        raise StopIteration
    return results, lprefix
Beispiel #5
0
def complete_rmdir(command: CommandContext):
    """
    Completion for "rmdir", includes only valid directory names.
    """
    opts = complete_from_man(CompletionContext(command))
    comps, lp = complete_dir(command)
    if len(comps) == 0 and len(opts) == 0:
        raise StopIteration
    return comps | opts, lp
Beispiel #6
0
def complete_rmdir(prefix, line, start, end, ctx):
    """
    Completion for "rmdir", includes only valid directory names.
    """
    if start != 0 and line.split(" ")[0] == "rmdir":
        opts = {i for i in complete_from_man("-", "rmdir -", 6, 7, ctx) if i.startswith(prefix)}
        comps, lp = complete_dir(prefix, line, start, end, ctx, True)
        return comps | opts, lp
    return set()
Beispiel #7
0
def complete_cd(prefix, line, start, end, ctx):
    """
    Completion for "cd", includes only valid directory names.
    """
    if start != 0 and line.split(" ")[0] == "cd":
        results, prefix = complete_dir(prefix, line, start, end, ctx, True)
        if len(results) == 0:
            raise StopIteration
        return results, prefix
    return set()
Beispiel #8
0
def complete_rmdir(prefix, line, start, end, ctx):
    """
    Completion for "rmdir", includes only valid directory names.
    """
    if start != 0 and line.split(' ')[0] == 'rmdir':
        opts = {i for i in complete_from_man('-', 'rmdir -', 6, 7, ctx)
                if i.startswith(prefix)}
        comps, lp = complete_dir(prefix, line, start, end, ctx, True)
        return comps | opts, lp
    return set()
Beispiel #9
0
def xonsh_complete(ctx: CommandContext):
    """
    Completion for "rmdir", includes only valid directory names.
    """
    # if starts with the given prefix then it will get completions from man page
    if not ctx.prefix.startswith("-") and ctx.arg_index > 0:
        comps, lprefix = complete_dir(ctx)
        if not comps:
            raise StopIteration  # no further file completions
        return comps, lprefix
Beispiel #10
0
def complete_rmdir(prefix, line, start, end, ctx):
    """
    Completion for "rmdir", includes only valid directory names.
    """
    if start != 0 and line.split(" ")[0] == "rmdir":
        opts = {
            i
            for i in complete_from_man("-", "rmdir -", 6, 7, ctx)
            if i.startswith(prefix)
        }
        comps, lp = complete_dir(prefix, line, start, end, ctx, True)
        if len(comps) == 0 and len(opts) == 0:
            raise StopIteration
        return comps | opts, lp
    return set()