2020-01-29 06:03:29 +08:00
|
|
|
# fish completion for pyenv
|
|
|
|
|
|
|
|
function __fish_pyenv_needs_command
|
2020-05-15 13:56:06 +08:00
|
|
|
set -l cmd (commandline -opc)
|
2020-01-29 06:03:29 +08:00
|
|
|
if [ (count $cmd) -eq 1 ]
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_pyenv_using_command
|
2020-05-15 13:56:06 +08:00
|
|
|
set -l cmd (commandline -opc)
|
2020-01-29 06:03:29 +08:00
|
|
|
if [ (count $cmd) -gt 1 ]
|
|
|
|
if [ $argv[1] = $cmd[2] ]
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_pyenv_executables
|
|
|
|
pyenv exec --complete
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_pyenv_installed_versions
|
|
|
|
pyenv versions --bare
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_pyenv_available_versions
|
|
|
|
# Remove trailing spaces, otherwise completion options appear like
|
|
|
|
# "\ \ option"
|
|
|
|
pyenv install --list | sed "s/^[[:space:]]*//"
|
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_pyenv_prefixes
|
|
|
|
pyenv prefix --complete
|
|
|
|
end
|
|
|
|
|
|
|
|
### commands
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a commands -d 'List all available pyenv commands'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command commands' -a '--sh --no-sh'
|
|
|
|
|
|
|
|
### completions
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a completions
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### exec
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a exec
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command exec' -a '(__fish_pyenv_executables)'
|
|
|
|
|
|
|
|
### global
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a global -d 'Set or show the global Python version'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command global' -a '(__fish_pyenv_installed_versions)'
|
|
|
|
|
|
|
|
### help
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a help
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### hooks
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a hooks -d 'List hook scripts for a given pyenv command'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### init
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a init -d 'Configure the shell environment for pyenv'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### install
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a install -d 'Install a Python version'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command install' -a '(__fish_pyenv_available_versions)'
|
|
|
|
|
|
|
|
### local
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a local -d 'Set or show the local application-specific Python version'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command local' -a '(__fish_pyenv_installed_versions)'
|
|
|
|
|
|
|
|
### prefix
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a prefix -d 'Display the directory where a Python version is installed'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command prefix' -a '(__fish_pyenv_prefixes)'
|
|
|
|
|
|
|
|
### rehash
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a rehash -d 'Rehash pyenv shims (run this after installing executables)'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### root
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a root -d 'Display the root directory where versions and shims are kept'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### shell
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a shell -d 'Set or show the shell-specific Python version'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command shell' -a '--unset (__fish_pyenv_installed_versions)'
|
|
|
|
|
|
|
|
### shims
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a shims -d 'List existing pyenv shims'
|
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command shims' -a --short
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version -d 'Show the current Python version & how it was selected'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version-file
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file -d 'Detect the file that sets the current pyenv version'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version-file-read
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file-read
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version-file-write
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version-file-write
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version-name
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version-name -d 'Show the current Python version'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### version-origin
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a version-origin -d 'Explain how the current Python version is set'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### versions
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a versions -d 'List all Python versions known by pyenv'
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### whence
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a whence -d 'List all Python versions that contain the given executable'
|
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command whence' -a --path
|
2020-01-29 06:03:29 +08:00
|
|
|
|
|
|
|
### which
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -f -c pyenv -n __fish_pyenv_needs_command -a which -d 'Show the full path for the given Python executable'
|
2020-01-29 06:03:29 +08:00
|
|
|
complete -f -c pyenv -n '__fish_pyenv_using_command which' -a '(__fish_pyenv_executables)'
|