Compare commits

...

9 Commits

Author SHA1 Message Date
Dossy Shiobara
a396d73a43
Merge 0bbeeffc7c into 31e8c93004 2024-12-18 12:30:39 -05:00
github-actions[bot]
31e8c93004
chore(master): release 0.15.0 (#1807)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-18 10:48:53 -05:00
ooo oo
c778ea1dec
docs: split Lint and Test badges for title asdf in README.MD (#1725)
Co-authored-by: Trevor Brown <Stratus3D@users.noreply.github.com>
2024-12-18 10:37:35 -05:00
Trevor Brown
98b8c6fd92 Merge branch 'OJarrisonn-nu/completion' 2024-12-18 10:32:27 -05:00
Trevor Brown
04fe7e30ca feat: correct description for version preceded by star 2024-12-18 10:31:05 -05:00
Trevor Brown
e8d6372564
Merge branch 'master' into nu/completion 2024-12-18 10:29:06 -05:00
Dossy Shiobara
0bbeeffc7c
fix: handle case correctly when shim_args is empty 2024-12-16 20:23:28 -05:00
Trevor Brown
8db4c60934
Merge branch 'master' into nu/completion 2024-12-16 19:41:14 -05:00
OJarrisonn
82be580602 feat: improved completions for version in commands
Improved completions for commands such as `asdf global <name> <version>` to list the installed versions

Added "complete asdf plugin versions installed" and "complete asdf plugin versions all" that produce completions for the installed versions and for all versions available for a given plugin

Improved `asdf install` completion to list the installed plugins and all the available versions
2024-06-01 17:40:04 -03:00
9 changed files with 90 additions and 23 deletions

View File

@ -1,5 +1,29 @@
# 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)

View File

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

View File

@ -9,7 +9,7 @@ not covered under this security policy.**
<!-- x-release-please-start-version -->
```
0.14.1
0.15.0
```
<!-- x-release-please-end -->

50
asdf.nu
View File

@ -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
export extern main [
subcommand?: string@"complete asdf sub-commands"
@ -145,15 +169,15 @@ module asdf {
# install a package version
export extern "asdf install" [
name?: string # Name of the package
version?: string # Version of the package or latest
name?: string@"complete asdf installed plugins" # Name of the package
version?: string@"complete asdf plugin versions all" # Version of the package or latest
]
# Remove an installed package version
export extern "asdf uninstall" [
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
@ -169,31 +193,31 @@ module asdf {
# Display install path for an installled package version
export extern "asdf where" [
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
export extern "asdf local" [
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
export extern "asdf global" [
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
export extern "asdf shell" [
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
export extern "asdf latest" [
name: string # Name of the package
version?: string # Filter latest stable version from this version
name: string@"complete asdf installed" # Name of the package
version?: string@"complete asdf plugin versions installed" # Filter latest stable version from this version
]
# Show latest stable version for all installed packages
@ -202,13 +226,13 @@ module asdf {
# List installed package versions
export extern "asdf list" [
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
export def "asdf list all" [
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
}
@ -216,7 +240,7 @@ module asdf {
# Show documentation for plugin
export extern "asdf help" [
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
@ -237,7 +261,7 @@ module asdf {
# Recreate shims for version package
export extern "asdf reshim" [
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

View File

@ -36,7 +36,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
```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
```

View File

@ -39,7 +39,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
<!-- x-release-please-start-version -->
```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 -->

View File

@ -35,7 +35,7 @@ asdf primarily requires `git` & `curl`. Here is a _non-exhaustive_ list of comma
<!-- x-release-please-start-version -->
```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 -->

View File

@ -3,7 +3,11 @@
shim_exec_command() {
local shim_name
shim_name=$(basename "$1")
local shim_args=("${@:2}")
local shim_args=()
if [ $# -gt 1 ]; then
shim_args=("${@:2}")
fi
if [ -z "$shim_name" ]; then
printf "usage: asdf exec <command>\n"
@ -20,12 +24,25 @@ shim_exec_command() {
exit 2
fi
asdf_run_hook "pre_${plugin_name}_${shim_name}" "${shim_args[@]}"
pre_status=$?
# Check if array is empty before using it
if [ ${#shim_args[@]} -eq 0 ]; then
asdf_run_hook "pre_${plugin_name}_${shim_name}"
pre_status=$?
else
asdf_run_hook "pre_${plugin_name}_${shim_name}" "${shim_args[@]}"
pre_status=$?
fi
if [ "$pre_status" -ne 0 ]; then
return "$pre_status"
fi
exec "$executable_path" "${shim_args[@]}"
# Check if array is empty before using it
if [ ${#shim_args[@]} -eq 0 ]; then
exec "$executable_path"
else
exec "$executable_path" "${shim_args[@]}"
fi
}
with_shim_executable "$shim_name" exec_shim || exit $?

View File

@ -1 +1 @@
0.14.1
0.15.0