From 7b1cf3151273e004c4ba8dd0ca10f9b11d8be41d Mon Sep 17 00:00:00 2001 From: Daniele Dellafiore <66707+ildella@users.noreply.github.com> Date: Tue, 14 May 2024 11:11:29 +0200 Subject: [PATCH 1/4] removed 'upgrade' as it's not a command anymore in v4 --- yarn-completion.bash | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/yarn-completion.bash b/yarn-completion.bash index 5eb68a7..014c285 100644 --- a/yarn-completion.bash +++ b/yarn-completion.bash @@ -477,7 +477,6 @@ _yarn_global() { bin list remove - upgrade upgrade-interactive ) cmdlist="@($(tr ' ' '|' <<< "${subcommands[*]}"))" @@ -843,42 +842,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=( @@ -1063,7 +1026,6 @@ _yarn() { team unlink unplug - upgrade upgrade-interactive version versions From 5fca73a4da1c11fa7bf1ddb0879b5ed9aa7306ef Mon Sep 17 00:00:00 2001 From: Daniele Dellafiore <66707+ildella@users.noreply.github.com> Date: Thu, 30 May 2024 12:22:24 +0200 Subject: [PATCH 2/4] upgrading to 4.x: updated docs, removed old commands, add all first level commands from https://yarnpkg.com/cli/ and the config subcommands as well. --- README.md | 4 ++-- yarn-completion.bash | 35 ++++++++++++++--------------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 63db487..2c971ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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 @@ -9,7 +9,7 @@ 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 diff --git a/yarn-completion.bash b/yarn-completion.bash index 014c285..d36813b 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 @@ -992,43 +991,37 @@ _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 + up upgrade-interactive version - versions why workspace workspaces From 104f132f92ef938fea19bd0a6d6dc0d9c2ea9827 Mon Sep 17 00:00:00 2001 From: Daniele Dellafiore <66707+ildella@users.noreply.github.com> Date: Thu, 30 May 2024 12:29:53 +0200 Subject: [PATCH 3/4] upgraded instructions for Linux --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 2c971ff..5f4159d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ > 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 To enable on-demand completion loading, download the completion file to the predefined bash-completion user directory. @@ -13,6 +22,7 @@ curl -o "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-c ``` ### 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**. From dab50b5fe745035ede130ceae37f3c7419f9483e Mon Sep 17 00:00:00 2001 From: Daniele Dellafiore <66707+ildella@users.noreply.github.com> Date: Mon, 3 Jun 2024 08:20:58 +0200 Subject: [PATCH 4/4] removed up --- yarn-completion.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn-completion.bash b/yarn-completion.bash index d36813b..269e251 100644 --- a/yarn-completion.bash +++ b/yarn-completion.bash @@ -1019,7 +1019,6 @@ _yarn() { stage unlink unplug - up upgrade-interactive version why