Обновление ohmyzsh

This commit is contained in:
2021-06-10 11:49:35 +05:00
parent 9fcc978a55
commit e7247fa93a
501 changed files with 18233 additions and 8842 deletions

View File

@@ -3,6 +3,12 @@
Plugin for SDKMAN, a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.
Provides autocompletion for all known commands.
To use it, add `sdk` to your plugins array in your zshrc file:
```zsh
plugins=(... sdk)
```
## Requirements
* [SDKMAN](http://sdkman.io/)
* [SDKMAN](http://sdkman.io/)

View File

@@ -1,82 +1,58 @@
#!/usr/bin/env zsh
### SDKMAN Autocomplete for Oh My Zsh
# This is the output from sdkman. All the these options are supported at the
# moment.
# Usage: sdk <command> [candidate] [version]
# sdk offline <enable|disable>
#
# commands:
# install or i <candidate> [version]
# uninstall or rm <candidate> <version>
# list or ls [candidate]
# use or u <candidate> [version]
# default or d <candidate> [version]
# current or c [candidate]
# upgrade or ug [candidate]
# version or v
# broadcast or b
# help or h
# offline [enable|disable]
# selfupdate [force]
# update
# flush <candidates|broadcast|archives|temp>
#
# candidate : the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
# use list command for comprehensive list of candidates
# eg: $ sdk list
#
# version : where optional, defaults to latest stable if not provided
# eg: $ sdk install groovy
local _sdk_commands=(
install i
uninstall rm
list ls
use u
default d
current c
upgrade ug
version v
broadcast b
help h
offline
selfupdate
update
flush
)
_listInstalledVersions() {
__sdkman_build_version_csv $1 | sed -e "s/,/ /g"
}
_listInstallableVersions() {
__sdkman_list_versions $1 | grep "^ " | sed -e "s/\* /*/g" | \
sed -e "s/>//g" | xargs -n 1 echo | grep -v "^*"
}
_listAllVersion() {
__sdkman_list_versions $1 | grep "^ " | sed -e "s/\*/ /g" | sed -e "s/>//g"
}
_sdk () {
case $CURRENT in
2) compadd -- $_sdk_commands ;;
3) case "$words[2]" in
i|install|rm|uninstall|ls|list|u|use|d|default|c|current|ug|upgrade)
compadd -- $SDKMAN_CANDIDATES ;;
offline) compadd -- enable disable ;;
selfupdate) compadd -- force ;;
flush) compadd -- candidates broadcast archives temp ;;
esac
;;
4) case "$words[2]" in
rm|uninstall|d|default) compadd -- $(_listInstalledVersions $words[3]) ;;
i|install) compadd -- $(_listInstallableVersions $words[3]) ;;
u|use) compadd -- $(_listAllVersion $words[3]) ;;
esac
;;
esac
_sdk() {
case "${CURRENT}" in
2)
compadd -X $'Commands:\n' -- "${${(Mk)functions[@]:#__sdk_*}[@]#__sdk_}"
compadd -n rm
;;
3)
case "${words[2]}" in
l|ls|list|i|install)
compadd -X $'Candidates:\n' -- "${SDKMAN_CANDIDATES[@]}"
;;
ug|upgrade|h|home|c|current|u|use|d|default|rm|uninstall)
compadd -X $'Installed Candidates:\n' -- "${${(u)${(f)$(find -L -- "${SDKMAN_CANDIDATES_DIR}" -mindepth 2 -maxdepth 2 -type d)}[@]:h}[@]:t}"
;;
e|env)
compadd init
;;
offline)
compadd enable disable
;;
selfupdate)
compadd force
;;
flush)
compadd archives broadcast temp version
;;
esac
;;
4)
case "${words[2]}" in
i|install)
setopt localoptions kshglob
if [[ "${words[3]}" == 'java' ]]; then
compadd -X $'Installable Versions of java:\n' -- "${${${${${(f)$(__sdkman_list_versions "${words[3]}")}[@]:5:-4}[@]:#* | (local only|installed ) | *}[@]##* | | }[@]%%+( )}"
else
compadd -X "Installable Versions of ${words[3]}:"$'\n' -- "${${(z)${(M)${(f)${$(__sdkman_list_versions "${words[3]}")//[*+>]+( )/-}}[@]:# *}[@]}[@]:#-*}"
fi
;;
h|home|u|use|d|default|rm|uninstall)
compadd -X "Installed Versions of ${words[3]}:"$'\n' -- "${${(f)$(find -L -- "${SDKMAN_CANDIDATES_DIR}/${words[3]}" -mindepth 1 -maxdepth 1 -type d -not -name 'current')}[@]:t}"
;;
esac
;;
5)
case "${words[2]}" in
i|install)
_files -X "Path to Local Installation of ${words[3]} ${words[4]}:"$'\n' -/
;;
esac
;;
esac
}
compdef _sdk sdk