From 8386cdc62824d41b5ad35c4f5cc3f1c6d12f1497 Mon Sep 17 00:00:00 2001 From: Auca Coyan Date: Thu, 28 Dec 2023 13:05:09 -0300 Subject: [PATCH] :bug: rename `yarn` for `yarn-v4` and add `run` cmpl (#720) Heya! This `yarn` file is aimed at the latest yarn v4, which has different commands than yarn classic (v1) I renamed the file to make that difference ``` custom-completions/yarn/yarn-completion.nu #to custom-completions/yarn/yarn-v4-completions.nu ``` and also added an improvement on `yarn run` which I have on `pnpm`, changing this ![image](https://github.com/nushell/nu_scripts/assets/30557287/d7a6a040-95f3-4ab5-8ab8-b59ea4a53433) into this ![image](https://github.com/nushell/nu_scripts/assets/30557287/95bd2edd-f633-4f37-8f4f-d511f037c270) (note that the new yarn adds the binaries in addition to the package.json scripts values) --- ...yarn-completion.nu => yarn-v4-completions.nu} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename custom-completions/yarn/{yarn-completion.nu => yarn-v4-completions.nu} (98%) diff --git a/custom-completions/yarn/yarn-completion.nu b/custom-completions/yarn/yarn-v4-completions.nu similarity index 98% rename from custom-completions/yarn/yarn-completion.nu rename to custom-completions/yarn/yarn-v4-completions.nu index fc2169b..db120c1 100644 --- a/custom-completions/yarn/yarn-completion.nu +++ b/custom-completions/yarn/yarn-v4-completions.nu @@ -382,14 +382,16 @@ export extern "yarn remove" [ ] def "nu-complete yarn run" [] { - let userScripts = (open ./package.json - |get scripts - |columns) + let userScripts = open ./package.json + | get scripts + | transpose + | rename value description - let binaries = (yarn bin --json - |lines - |each { |it| $it | from json} - |get name) + let binaries = yarn bin --json + | lines + | each { |it| $it | from json } + | select name source + | rename value description $userScripts | append $binaries }