diff --git a/README.md b/README.md index 63db487..5f4159d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # yarn-completion ![](https://github.com/dsifford/yarn-completion/workflows/build/badge.svg) -> Bash ^4.x completion for [Yarn](https://github.com/yarnpkg/yarn) +> Bash ^4.x completion for [Yarn CLI 4.x](https://yarnpkg.com/cli) + +## Installation on Debian Linux + +Just grab the file and move it to bash completion global folder: + +```shell +wget https://raw.githubusercontent.com/ildella/yarn-completion/master/yarn-completion.bash yarn-completion.bash +sudo mv yarn-completion.bash /etc/bash_completion.d +``` ## Installation @@ -9,10 +18,11 @@ To enable on-demand completion loading, download the completion file to the pred ```sh mkdir -p "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions/" curl -o "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions/yarn" \ - https://raw.githubusercontent.com/dsifford/yarn-completion/master/yarn-completion.bash + https://raw.githubusercontent.com/ildella/yarn-completion/master/yarn-completion.bash ``` ### Installation on macOS with Homebrew + To use this script on macOS, we need to install [bash](https://www.gnu.org/software/bash/) and [bash-completion](https://github.com/scop/bash-completion) in addition to the above script. 1. `bash` version ^4.x.x is **required**. diff --git a/yarn-completion.bash b/yarn-completion.bash index 5eb68a7..269e251 100644 --- a/yarn-completion.bash +++ b/yarn-completion.bash @@ -377,10 +377,9 @@ _yarn_config() { ((depth++)) declare cmd declare subcommands=( - delete get - list set + unset ) declare known_keys=( ignore-optional @@ -477,7 +476,6 @@ _yarn_global() { bin list remove - upgrade upgrade-interactive ) cmdlist="@($(tr ' ' '|' <<< "${subcommands[*]}"))" @@ -843,42 +841,6 @@ _yarn_unplug() { return 1 } -_yarn_upgrade() { - ((depth++)) - declare cmd dependencies devDependencies - flags=( - --audit -A - --caret -C - --exact -E - --latest -L - --pattern -P - --scope -S - --tilde -T - ) - __yarn_get_command -d 1 - case "$cmd" in - global) - dependencies=$(__yarn_get_package_fields -g dependencies) - devDependencies='' - ;; - upgrade) - dependencies=$(__yarn_get_package_fields dependencies) - devDependencies=$(__yarn_get_package_fields devDependencies) - ;; - *) - return 1 - ;; - esac - case "$cur" in - -*) ;; - *) - COMPREPLY=($(compgen -W "$dependencies $devDependencies" -- "$cur")) - return 0 - ;; - esac - return 1 -} - _yarn_upgrade_interactive() { ((depth++)) flags=( @@ -1029,44 +991,36 @@ _yarn() { declare -a words declare -i cword counter=1 depth=1 declare -ar commands=( - access add - audit - autoclean bin cache - check config + constraints create + dedupe + dix exec - generate-lock-entry - global - help - import + explain info init install - licenses link - list - login - logout node - outdated - owner + npm pack - policies - publish + patch-commit + patch + plugin + rebuild remove run - tag - team + search + set + stage unlink unplug - upgrade upgrade-interactive version - versions why workspace workspaces