mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge pull request #504 from asdf-vm/fix-current-comments
Fix current when .tool-versions contains comments
This commit is contained in:
commit
5e2468a16d
@ -269,7 +269,7 @@ parse_asdf_version_file() {
|
||||
|
||||
if [ -f "$file_path" ]; then
|
||||
local version
|
||||
version=$(grep "^${plugin_name} " "$file_path" | sed -e "s/^${plugin_name} //")
|
||||
version=$(strip_tool_version_comments "$file_path" | grep "^${plugin_name} "| sed -e "s/^${plugin_name} //")
|
||||
if [ -n "$version" ]; then
|
||||
echo "$version"
|
||||
return 0
|
||||
|
@ -121,3 +121,13 @@ foobar 1.0.0 (set by $PROJECT_DIR/.tool-versions)"
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output" | grep "Oohes nooes ~! No plugins installed"
|
||||
}
|
||||
|
||||
@test "current should handle comments" {
|
||||
cd $PROJECT_DIR
|
||||
echo "dummy 1.2.0 # this is a comment" >> $PROJECT_DIR/.tool-versions
|
||||
|
||||
run asdf current "dummy"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "1.2.0 (set by $PROJECT_DIR/.tool-versions)" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user