fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMerge branch 'completions-to-use-expanded-tokens'a9618477e

master
4.2 KiB116 linesraw
1# fish completion for pyenv
2
3function __fish_pyenv_needs_command
4    set -l cmd (commandline -xpc)
5    if test (count $cmd) -eq 1
6        return 0
7    end
8    return 1
9end
10
11function __fish_pyenv_using_command
12    set -l cmd (commandline -xpc)
13    if test (count $cmd) -gt 1
14        if test $argv[1] = $cmd[2]
15            return 0
16        end
17    end
18    return 1
19end
20
21function __fish_pyenv_executables
22    pyenv exec --complete
23end
24
25function __fish_pyenv_installed_versions
26    pyenv versions --bare
27end
28
29function __fish_pyenv_available_versions
30    # Remove trailing spaces, otherwise completion options appear like
31    # "\ \ option"
32    pyenv install --list | sed "s/^[[:space:]]*//"
33end
34
35function __fish_pyenv_prefixes
36    pyenv prefix --complete
37end
38
39### commands
40complete -f -c pyenv -n __fish_pyenv_needs_command -a commands -d 'List all available pyenv commands'
41complete -f -c pyenv -n '__fish_pyenv_using_command commands' -a '--sh --no-sh'
42
43### completions
44complete -f -c pyenv -n __fish_pyenv_needs_command -a completions
45
46### exec
47complete -f -c pyenv -n __fish_pyenv_needs_command -a exec
48complete -f -c pyenv -n '__fish_pyenv_using_command exec' -a '(__fish_pyenv_executables)'
49
50### global
51complete -f -c pyenv -n __fish_pyenv_needs_command -a global -d 'Set or show the global Python version'
52complete -f -c pyenv -n '__fish_pyenv_using_command global' -a '(__fish_pyenv_installed_versions)'
53
54### help
55complete -f -c pyenv -n __fish_pyenv_needs_command -a help
56
57### hooks
58complete -f -c pyenv -n __fish_pyenv_needs_command -a hooks -d 'List hook scripts for a given pyenv command'
59
60### init
61complete -f -c pyenv -n __fish_pyenv_needs_command -a init -d 'Configure the shell environment for pyenv'
62
63### install
64complete -f -c pyenv -n __fish_pyenv_needs_command -a install -d 'Install a Python version'
65complete -f -c pyenv -n '__fish_pyenv_using_command install' -a '(__fish_pyenv_available_versions)'
66
67### local
68complete -f -c pyenv -n __fish_pyenv_needs_command -a local -d 'Set or show the local application-specific Python version'
69complete -f -c pyenv -n '__fish_pyenv_using_command local' -a '(__fish_pyenv_installed_versions)'
70
71### prefix
72complete -f -c pyenv -n __fish_pyenv_needs_command -a prefix -d 'Display the directory where a Python version is installed'
73complete -f -c pyenv -n '__fish_pyenv_using_command prefix' -a '(__fish_pyenv_prefixes)'
74
75### rehash
76complete -f -c pyenv -n __fish_pyenv_needs_command -a rehash -d 'Rehash pyenv shims (run this after installing executables)'
77
78### root
79complete -f -c pyenv -n __fish_pyenv_needs_command -a root -d 'Display the root directory where versions and shims are kept'
80
81### shell
82complete -f -c pyenv -n __fish_pyenv_needs_command -a shell -d 'Set or show the shell-specific Python version'
83complete -f -c pyenv -n '__fish_pyenv_using_command shell' -a '--unset (__fish_pyenv_installed_versions)'
84
85### shims
86complete -f -c pyenv -n __fish_pyenv_needs_command -a shims -d 'List existing pyenv shims'
87complete -f -c pyenv -n '__fish_pyenv_using_command shims' -a --short
88
89### version
90complete -f -c pyenv -n __fish_pyenv_needs_command -a version -d 'Show the current Python version & how it was selected'
91
92### version-file
93complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file -d 'Detect the file that sets the current pyenv version'
94
95### version-file-read
96complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file-read
97
98### version-file-write
99complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file-write
100
101### version-name
102complete -f -c pyenv -n __fish_pyenv_needs_command -a version-name -d 'Show the current Python version'
103
104### version-origin
105complete -f -c pyenv -n __fish_pyenv_needs_command -a version-origin -d 'Explain how the current Python version is set'
106
107### versions
108complete -f -c pyenv -n __fish_pyenv_needs_command -a versions -d 'List all Python versions known by pyenv'
109
110### whence
111complete -f -c pyenv -n __fish_pyenv_needs_command -a whence -d 'List all Python versions that contain the given executable'
112complete -f -c pyenv -n '__fish_pyenv_using_command whence' -a --path
113
114### which
115complete -f -c pyenv -n __fish_pyenv_needs_command -a which -d 'Show the full path for the given Python executable'
116complete -f -c pyenv -n '__fish_pyenv_using_command which' -a '(__fish_pyenv_executables)'