fix: nushell plugin list all (#1501) (#1502)

This commit is contained in:
Andrea Jemmett 2023-03-21 09:53:10 +01:00 committed by GitHub
parent 3379af845e
commit c5b8b3c128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -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 |

View File

@ -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" ]
}