From c5b8b3c128b48e1531f6d03d2083435f413a4738 Mon Sep 17 00:00:00 2001 From: Andrea Jemmett <1787979+acidghost@users.noreply.github.com> Date: Tue, 21 Mar 2023 09:53:10 +0100 Subject: [PATCH] fix: nushell plugin list all (#1501) (#1502) --- asdf.nu | 2 +- test/asdf_nu.bats | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/asdf.nu b/asdf.nu index 092fd3bec..bf787128e 100644 --- a/asdf.nu +++ b/asdf.nu @@ -99,7 +99,7 @@ module asdf { # list all available plugins export def "asdf plugin list all" [] { - let template = '(?P.+)\s+?(?P[*]?)(?P(?:git|http).+\.git)' + let template = '(?P.+)\s+?(?P[*]?)(?P(?:git|http|https).+)' let is_installed = { |it| $it.installed == '*' } ^asdf plugin list all | diff --git a/test/asdf_nu.bats b/test/asdf_nu.bats index 9319e7eae..b93a6ea7e 100644 --- a/test/asdf_nu.bats +++ b/test/asdf_nu.bats @@ -9,6 +9,14 @@ setup() { if ! command -v nu; then skip "Nu is not installed" fi + + setup_asdf_dir + setup_repo + install_dummy_plugin +} + +teardown() { + clean_asdf_dir } cleaned_path() { @@ -110,3 +118,20 @@ cleaned_path() { result=$(echo "$output" | grep "ASDF INSTALLED PLUGINS:") [ "$result" != "" ] } + +@test "parses the output of asdf plugin list all" { + run nu -c " + hide-env -i asdf + hide-env -i ASDF_DIR + let-env PATH = ( '$(cleaned_path)' | split row ':' ) + let-env ASDF_NU_DIR = '$PWD' + + source asdf.nu + asdf plugin list all | to csv -n" + + [ "$status" -eq 0 ] + [ "$output" = "\ +bar,false,http://example.com/bar +dummy,true,http://example.com/dummy +foo,false,http://example.com/foo" ] +}