mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-23 20:05:09 -07:00
Compare commits
12 Commits
2b66dd4046
...
6c5ced9d25
Author | SHA1 | Date | |
---|---|---|---|
|
6c5ced9d25 | ||
|
31e8c93004 | ||
|
c778ea1dec | ||
|
98b8c6fd92 | ||
|
04fe7e30ca | ||
|
e8d6372564 | ||
|
8db4c60934 | ||
|
36fd9f8a4b | ||
|
437453110c | ||
|
5c30032f44 | ||
|
5c69d8d852 | ||
|
82be580602 |
24
CHANGELOG.md
24
CHANGELOG.md
@ -1,5 +1,29 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.15.0](https://github.com/asdf-vm/asdf/compare/v0.14.1...v0.15.0) (2024-12-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* golang-rewrite: remove `asdf update` command to prepare for Go version ([#1806](https://github.com/asdf-vm/asdf/issues/1806)) ([15571a2](https://github.com/asdf-vm/asdf/commit/15571a2d28818644673bbaf0fcf7d1d9e342cda4))
|
||||||
|
|
||||||
|
|
||||||
|
### Patches
|
||||||
|
|
||||||
|
* completions: Address two Bash completion bugs ([#1770](https://github.com/asdf-vm/asdf/issues/1770)) ([ebdb229](https://github.com/asdf-vm/asdf/commit/ebdb229ce68979a18dae5c0922620b860c56b22f))
|
||||||
|
* make plugin-test work on alpine linux ([#1778](https://github.com/asdf-vm/asdf/issues/1778)) ([f5a1f3a](https://github.com/asdf-vm/asdf/commit/f5a1f3a0a8bb50796f6ccf618d2bf4cf3bdea097))
|
||||||
|
* nushell: nushell spread operator ([#1777](https://github.com/asdf-vm/asdf/issues/1777)) ([a0ce37b](https://github.com/asdf-vm/asdf/commit/a0ce37b89bd5eb4ddaa806f96305ee99a8c5d365))
|
||||||
|
* nushell: Use correct env var for shims dir ([#1742](https://github.com/asdf-vm/asdf/issues/1742)) ([2f07629](https://github.com/asdf-vm/asdf/commit/2f0762991c35da933b81ba6ab75457a504deedbb))
|
||||||
|
* when download path got removed, it should use -f to force delete the download files ([#1746](https://github.com/asdf-vm/asdf/issues/1746)) ([221507f](https://github.com/asdf-vm/asdf/commit/221507f1c0288f0df13315a7f0f2c0a7bc39e7c2))
|
||||||
|
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
* add Korean translation ([#1757](https://github.com/asdf-vm/asdf/issues/1757)) ([9e16306](https://github.com/asdf-vm/asdf/commit/9e16306f42b4bbffd62779aaebb9cbbc9ba59007))
|
||||||
|
* propose edits for tiny typographical/grammatical errors ([#1747](https://github.com/asdf-vm/asdf/issues/1747)) ([d462b55](https://github.com/asdf-vm/asdf/commit/d462b55ec9868eeaddba4b70850aba908236dd93))
|
||||||
|
* split Lint and Test badges for title asdf in `README.MD` ([#1725](https://github.com/asdf-vm/asdf/issues/1725)) ([c778ea1](https://github.com/asdf-vm/asdf/commit/c778ea1deca19d8ccd91253c2f206a6b51a0a9b1))
|
||||||
|
* Update Japanese(ja-jp) Translations ([#1715](https://github.com/asdf-vm/asdf/issues/1715)) ([bd19e4c](https://github.com/asdf-vm/asdf/commit/bd19e4cbdc2f0a9380dbdfcec46584d619e8ed56))
|
||||||
|
|
||||||
## [0.14.1](https://github.com/asdf-vm/asdf/compare/v0.14.0...v0.14.1) (2024-08-15)
|
## [0.14.1](https://github.com/asdf-vm/asdf/compare/v0.14.0...v0.14.1) (2024-08-15)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# asdf [![Lint](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml) [![Tests](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml)
|
# asdf
|
||||||
|
|
||||||
|
[![Lint](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml) [![Tests](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml)
|
||||||
|
|
||||||
**Manage multiple runtime versions with a single CLI tool, extendable via plugins** - [docs at asdf-vm.com](https://asdf-vm.com/)
|
**Manage multiple runtime versions with a single CLI tool, extendable via plugins** - [docs at asdf-vm.com](https://asdf-vm.com/)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ not covered under this security policy.**
|
|||||||
<!-- x-release-please-start-version -->
|
<!-- x-release-please-start-version -->
|
||||||
|
|
||||||
```
|
```
|
||||||
0.14.1
|
0.15.0
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- x-release-please-end -->
|
<!-- x-release-please-end -->
|
||||||
|
50
asdf.nu
50
asdf.nu
@ -74,6 +74,30 @@ module asdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def "complete asdf plugin versions all" [context: string] {
|
||||||
|
let plugin = $context | str trim | split words | last
|
||||||
|
^asdf list all $plugin
|
||||||
|
| lines
|
||||||
|
| each { |line| $line | str trim }
|
||||||
|
| prepend "latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
def "complete asdf plugin versions installed" [context: string] {
|
||||||
|
let plugin = $context | str trim | split words | last
|
||||||
|
let versions = ^asdf list $plugin
|
||||||
|
| lines
|
||||||
|
| each { |line| $line | str trim }
|
||||||
|
| each { |version| if ($version | str starts-with "*") {{value: ($version | str substring 1..), description: "current version"}} else {{value: $version, description: ""}} }
|
||||||
|
|
||||||
|
let latest = ^asdf latest $plugin | str trim
|
||||||
|
|
||||||
|
if ($versions | get value | any {|el| $el == $latest}) {
|
||||||
|
$versions | prepend {value: "latest", description: $"alias to ($latest)"}
|
||||||
|
} else {
|
||||||
|
$versions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# ASDF version manager
|
# ASDF version manager
|
||||||
export extern main [
|
export extern main [
|
||||||
subcommand?: string@"complete asdf sub-commands"
|
subcommand?: string@"complete asdf sub-commands"
|
||||||
@ -145,15 +169,15 @@ module asdf {
|
|||||||
|
|
||||||
# install a package version
|
# install a package version
|
||||||
export extern "asdf install" [
|
export extern "asdf install" [
|
||||||
name?: string # Name of the package
|
name?: string@"complete asdf installed plugins" # Name of the package
|
||||||
version?: string # Version of the package or latest
|
version?: string@"complete asdf plugin versions all" # Version of the package or latest
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Remove an installed package version
|
# Remove an installed package version
|
||||||
export extern "asdf uninstall" [
|
export extern "asdf uninstall" [
|
||||||
name: string@"complete asdf installed" # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version: string # Version of the package
|
version: string@"complete asdf plugin versions installed" # Version of the package
|
||||||
]
|
]
|
||||||
|
|
||||||
# Display current version
|
# Display current version
|
||||||
@ -169,31 +193,31 @@ module asdf {
|
|||||||
# Display install path for an installled package version
|
# Display install path for an installled package version
|
||||||
export extern "asdf where" [
|
export extern "asdf where" [
|
||||||
name: string@"complete asdf installed" # Name of installed package
|
name: string@"complete asdf installed" # Name of installed package
|
||||||
version?: string # Version of installed package
|
version?: string@"complete asdf plugin versions installed" # Version of installed package
|
||||||
]
|
]
|
||||||
|
|
||||||
# Set the package local version
|
# Set the package local version
|
||||||
export extern "asdf local" [
|
export extern "asdf local" [
|
||||||
name: string@"complete asdf installed" # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Version of the package or latest
|
version?: string@"complete asdf plugin versions installed" # Version of the package or latest
|
||||||
]
|
]
|
||||||
|
|
||||||
# Set the package global version
|
# Set the package global version
|
||||||
export extern "asdf global" [
|
export extern "asdf global" [
|
||||||
name: string@"complete asdf installed" # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Version of the package or latest
|
version?: string@"complete asdf plugin versions installed" # Version of the package or latest
|
||||||
]
|
]
|
||||||
|
|
||||||
# Set the package to version in the current shell
|
# Set the package to version in the current shell
|
||||||
export extern "asdf shell" [
|
export extern "asdf shell" [
|
||||||
name: string@"complete asdf installed" # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Version of the package or latest
|
version?: string@"complete asdf plugin versions installed" # Version of the package or latest
|
||||||
]
|
]
|
||||||
|
|
||||||
# Show latest stable version of a package
|
# Show latest stable version of a package
|
||||||
export extern "asdf latest" [
|
export extern "asdf latest" [
|
||||||
name: string # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Filter latest stable version from this version
|
version?: string@"complete asdf plugin versions installed" # Filter latest stable version from this version
|
||||||
]
|
]
|
||||||
|
|
||||||
# Show latest stable version for all installed packages
|
# Show latest stable version for all installed packages
|
||||||
@ -202,13 +226,13 @@ module asdf {
|
|||||||
# List installed package versions
|
# List installed package versions
|
||||||
export extern "asdf list" [
|
export extern "asdf list" [
|
||||||
name?: string@"complete asdf installed" # Name of the package
|
name?: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Filter the version
|
version?: string@"complete asdf plugin versions installed" # Filter the version
|
||||||
]
|
]
|
||||||
|
|
||||||
# List all available package versions
|
# List all available package versions
|
||||||
export def "asdf list all" [
|
export def "asdf list all" [
|
||||||
name: string@"complete asdf installed" # Name of the package
|
name: string@"complete asdf installed" # Name of the package
|
||||||
version?: string="" # Filter the version
|
version?: string@"complete asdf plugin versions installed"="" # Filter the version
|
||||||
] {
|
] {
|
||||||
^asdf list all $name $version | lines | parse "{version}" | str trim
|
^asdf list all $name $version | lines | parse "{version}" | str trim
|
||||||
}
|
}
|
||||||
@ -216,7 +240,7 @@ module asdf {
|
|||||||
# Show documentation for plugin
|
# Show documentation for plugin
|
||||||
export extern "asdf help" [
|
export extern "asdf help" [
|
||||||
name: string@"complete asdf installed" # Name of the plugin
|
name: string@"complete asdf installed" # Name of the plugin
|
||||||
version?: string # Version of the plugin
|
version?: string@"complete asdf plugin versions installed" # Version of the plugin
|
||||||
]
|
]
|
||||||
|
|
||||||
# Execute a command shim for the current version
|
# Execute a command shim for the current version
|
||||||
@ -237,7 +261,7 @@ module asdf {
|
|||||||
# Recreate shims for version package
|
# Recreate shims for version package
|
||||||
export extern "asdf reshim" [
|
export extern "asdf reshim" [
|
||||||
name?: string@"complete asdf installed" # Name of the package
|
name?: string@"complete asdf installed" # Name of the package
|
||||||
version?: string # Version of the package
|
version?: string@"complete asdf plugin versions installed" # Version of the package
|
||||||
]
|
]
|
||||||
|
|
||||||
# List the plugins and versions that provide a command
|
# List the plugins and versions that provide a command
|
||||||
|
@ -36,7 +36,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
|
|||||||
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
|
|||||||
<!-- x-release-please-start-version -->
|
<!-- x-release-please-start-version -->
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- x-release-please-end -->
|
<!-- x-release-please-end -->
|
||||||
|
@ -35,7 +35,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
|
|||||||
<!-- x-release-please-start-version -->
|
<!-- x-release-please-start-version -->
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.15.0
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- x-release-please-end -->
|
<!-- x-release-please-end -->
|
||||||
|
@ -53,8 +53,12 @@ version_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! (check_if_version_exists "$plugin_name" "$version"); then
|
if ! (check_if_version_exists "$plugin_name" "$version"); then
|
||||||
version_not_installed_text "$plugin_name" "$version" 1>&2
|
closest_version=$(try_get_closest_version "$plugin_name" "$version")
|
||||||
exit 1
|
if [[ ! $closest_version ]]; then
|
||||||
|
version_not_installed_text "$plugin_name" "$version" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
version="$closest_version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
resolved_versions+=("$version")
|
resolved_versions+=("$version")
|
||||||
|
@ -137,6 +137,26 @@ check_if_version_exists() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try_get_closest_version() {
|
||||||
|
local plugin_name=$1
|
||||||
|
local partial_version=$2
|
||||||
|
local versions
|
||||||
|
|
||||||
|
versions=$(list_installed_versions "$plugin_name")
|
||||||
|
|
||||||
|
if [ -n "${versions}" ]; then
|
||||||
|
for version in $versions; do
|
||||||
|
if [[ $version == $partial_version* ]]; then
|
||||||
|
matched_versions+=("$version")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${#matched_versions[@]} -eq 1 ]; then
|
||||||
|
printf "%s" "${matched_versions[0]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
version_not_installed_text() {
|
version_not_installed_text() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local version=$2
|
local version=$2
|
||||||
|
@ -204,6 +204,18 @@ teardown() {
|
|||||||
[ "$(cat "$HOME/.tool-versions")" = "dummy 1.1.0" ]
|
[ "$(cat "$HOME/.tool-versions")" = "dummy 1.1.0" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "global should create a global .tool-versions file when a close version is found" {
|
||||||
|
run asdf global "dummy" "1.1"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$(cat "$HOME/.tool-versions")" = "dummy 1.1.0" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "global should emit an error when a single close plugin version is not found" {
|
||||||
|
run asdf global "dummy" "1"
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
[ "$output" = "version 1 is not installed for dummy" ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "[global - dummy_plugin] with latest should use the latest installed version" {
|
@test "[global - dummy_plugin] with latest should use the latest installed version" {
|
||||||
run asdf global "dummy" "latest"
|
run asdf global "dummy" "latest"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
@ -1 +1 @@
|
|||||||
0.14.1
|
0.15.0
|
||||||
|
Loading…
Reference in New Issue
Block a user