2012-07-28 16:42:09 +00:00
|
|
|
# fish completion for rbenv
|
|
|
|
|
|
|
|
function __fish_rbenv_needs_command
|
2019-05-05 10:53:09 +00:00
|
|
|
set cmd (commandline -opc)
|
|
|
|
if [ (count $cmd) -eq 1 ]
|
|
|
|
return 0
|
|
|
|
end
|
2012-07-28 16:42:09 +00:00
|
|
|
|
2019-05-05 10:53:09 +00:00
|
|
|
return 1
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_rbenv_using_command
|
2019-05-05 10:53:09 +00:00
|
|
|
set cmd (commandline -opc)
|
|
|
|
if [ (count $cmd) -gt 1 ]
|
|
|
|
if [ $argv[1] = $cmd[2] ]
|
|
|
|
return 0
|
|
|
|
end
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
2019-05-05 10:53:09 +00:00
|
|
|
return 1
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_rbenv_executables
|
2019-05-05 10:53:09 +00:00
|
|
|
rbenv exec --complete
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_rbenv_installed_rubies
|
2019-05-05 10:53:09 +00:00
|
|
|
rbenv versions --bare
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_rbenv_official_rubies
|
2019-05-05 10:53:09 +00:00
|
|
|
if command -sq ruby-build
|
|
|
|
ruby-build --definitions
|
|
|
|
else
|
|
|
|
# Remove trailing spaces, otherwise completion options appear like
|
|
|
|
# "\ \ option"
|
|
|
|
rbenv install --list | sed "s/^[[:space:]]*//"
|
|
|
|
end
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_rbenv_prefixes
|
2019-05-05 10:53:09 +00:00
|
|
|
rbenv prefix --complete
|
2012-07-28 16:42:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
### commands
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a commands -d 'List all available rbenv commands'
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command commands' -a '--sh --no-sh'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### completions
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a completions
|
|
|
|
|
|
|
|
### exec
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a exec
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command exec' -a '(__fish_rbenv_executables)'
|
|
|
|
|
|
|
|
### global
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a global -d 'Set or show the global Ruby version'
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command global' -a '(__fish_rbenv_installed_rubies)'
|
|
|
|
|
|
|
|
### help
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a help
|
|
|
|
|
|
|
|
### hooks
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a hooks -d 'List hook scripts for a given rbenv command'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### init
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a init -d 'Configure the shell environment for rbenv'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### install
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a install -d 'Install a Ruby version'
|
2012-07-28 16:42:09 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command install' -a '(__fish_rbenv_official_rubies)'
|
|
|
|
|
|
|
|
### local
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a local -d 'Set or show the local application-specific Ruby version'
|
2012-07-28 16:42:09 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command local' -a '(__fish_rbenv_installed_rubies)'
|
|
|
|
|
|
|
|
### prefix
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a prefix -d 'Display the directory where a Ruby version is installed'
|
2012-07-28 16:42:09 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command prefix' -a '(__fish_rbenv_prefixes)'
|
|
|
|
|
|
|
|
### rehash
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a rehash -d 'Rehash rbenv shims (run this after installing executables)'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### root
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a root -d 'Display the root directory where versions and shims are kept'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### shell
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a shell -d 'Set or show the shell-specific Ruby version'
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command shell' -a '--unset (__fish_rbenv_installed_rubies)'
|
|
|
|
|
|
|
|
### shims
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a shims -d 'List existing rbenv shims'
|
2012-07-28 16:42:09 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command shims' -a '--short'
|
|
|
|
|
|
|
|
### version
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version -d 'Show the current Ruby version & how it was selected'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### version-file
|
2020-02-17 07:45:22 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version-file -d 'Detect the file that sets the current rbenv version'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### version-file-read
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version-file-read
|
|
|
|
|
|
|
|
### version-file-write
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version-file-write
|
|
|
|
|
|
|
|
### version-name
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version-name -d 'Show the current Ruby version'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### version-origin
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a version-origin -d 'Explain how the current Ruby version is set'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### versions
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a versions -d 'List all Ruby versions known by rbenv'
|
|
|
|
|
|
|
|
### whence
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a whence -d 'List all Ruby versions that contain the given executable'
|
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command whence' -a '--path'
|
2012-07-28 16:42:09 +00:00
|
|
|
|
|
|
|
### which
|
2020-01-28 21:58:58 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_needs_command' -a which -d 'Show the full path for the given Ruby executable'
|
2012-07-28 16:42:09 +00:00
|
|
|
complete -f -c rbenv -n '__fish_rbenv_using_command which' -a '(__fish_rbenv_executables)'
|