Skip to content

Commit

Permalink
fix: nushell plugin list all (asdf-vm#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
acidghost committed Mar 21, 2023
1 parent 0adc6c1 commit de6bf4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion asdf.nu
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module asdf {

# list all available plugins
export def "asdf plugin list all" [] {
let template = '(?P<name>.+)\s+?(?P<installed>[*]?)(?P<repository>(?:git|http).+\.git)'
let template = '(?P<name>.+)\s+?(?P<installed>[*]?)(?P<repository>(?:git|http|https).+)'
let is_installed = { |it| $it.installed == '*' }

^asdf plugin list all |
Expand Down
25 changes: 25 additions & 0 deletions test/asdf_nu.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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" ]
}

0 comments on commit de6bf4f

Please sign in to comment.