Compare commits

..

174 Commits

Author SHA1 Message Date
Trevor Brown
9c12b79969
Merge pull request #98 from asdf-vm/tb/breaking-changes-update
feat(golang-rewrite): update upgrade guide
2024-12-18 14:11:39 -05:00
Trevor Brown
005898800b feat(golang-rewrite): update upgrade guide 2024-12-18 14:10:04 -05:00
Trevor Brown
875bee8f36
Merge pull request #97 from asdf-vm/tb/self-contained-completions
feat(golang-rewrite): self-contained completion code
2024-12-18 12:29:33 -05:00
Trevor Brown
c8593842ee feat(golang-rewrite): self-contained completion code
* Add `asdf completion` command
* Move completion files to `cli/completions`
* Add completions for Bash, Zsh, Fish, Elvish, and Nushell
* Update Zsh completion code to work with new completion install method
2024-12-18 12:23:40 -05:00
Trevor Brown
08ca28f53d Merge pull request #96 from asdf-vm/tb/version-improvements-2
feat(golang-rewrite): misc. version improvements part 2
2024-12-18 11:32:04 -05:00
Trevor Brown
e69149ef38 Merge pull request #95 from asdf-vm/tb/version-improvements
feat(golang-rewrite): misc. version improvements
2024-12-18 11:32:04 -05:00
Trevor Brown
b9e79e6456 feat(golang-rewrite): misc. version improvements part 2
* Remove old commands from help output
* Add message to `asdf update` command
* Explain why `asdf global` and `asdf local` have been removed
* Add reference argument to `git.Repoer.Clone` method
* Update `asdf plugin test` command to install specific ref of plugin if provided
* Update `asdf plugin update` command to run pre and post plugin update hooks, and `post-plugin-update` plugin callback
* Enable `plugin_update_command.bats` tests
2024-12-18 11:32:04 -05:00
Trevor Brown
76bc18a1b9 Merge pull request #94 from asdf-vm/tb/plugin-improvements
feat(golang-rewrite): misc. plugin improvements
2024-12-18 11:32:04 -05:00
Trevor Brown
9ed4216525 feat(golang-rewrite): misc. version improvements
* Update `pluginListCommand` to print tools and versions to STDOUT
* Improve output of `asdf current` command
2024-12-18 11:32:04 -05:00
Trevor Brown
b7193e43ef Merge pull request #93 from asdf-vm/tb/go-upgrade
chore(golang-rewrite): upgrade to Go 1.23.4
2024-12-18 11:32:04 -05:00
Trevor Brown
3af0291316 feat(golang-rewrite): misc. plugin improvements
* Correct the environment `bin/install` runs in
* Improve output of `asdf list all` command when plugin not found
* Update `asdf plugin test` command to install a tool version in the test
2024-12-18 11:32:04 -05:00
Trevor Brown
f0d74ece4d Merge pull request #92 from asdf-vm/DeedleFake-rename-module-and-use-cmd-dir
feat(golang-rewrite): rename module and move `main` pacakge to `cmd/asdf`
2024-12-18 11:32:04 -05:00
Trevor Brown
d2fcf6fef5 chore(golang-rewrite): upgrade to Go 1.23.4
* Fix `release-build` workflow
* Upgrade to Go 1.23.4
2024-12-18 11:32:04 -05:00
Trevor Brown
7896be10ea Merge pull request #91 from asdf-vm/tb/plugin-test-command
feat(golang-rewrite): implement `asdf plugin test` command
2024-12-18 11:32:04 -05:00
DeedleFake
5d5d04fbb7 feat(golang-rewrite): rename module and move main pacakge to cmd/asdf
* Replace direct `fmt.Println()` usage in a test with `t.Log()`
* Rename `cmd` to `cli`
* Move asdf command from module root
* Fix some linter warnings, thus enabling some tests that were being skipped
* Fix `Makefile`
* Rename module to `github.com/asdf-vm/asdf`
* Fix `TestGetAllToolsAndVersionsInContent/returns_empty_list_with_found_true_and_no_error_when_empty_content`
* Rewrite `Unique()` to be a bit more straightforwards
* Get workflow checks passing again

toolversions.Unique is ever so slightly faster, technically.

```
goos: linux
goarch: amd64
pkg: github.com/asdf-vm/asdf/internal/toolversions
cpu: AMD Ryzen 9 3900X 12-Core Processor
          │ /tmp/old.txt │            /tmp/new.txt            │
          │    sec/op    │   sec/op     vs base               │
Unique-24    346.5n ± 1%   342.4n ± 1%  -1.17% (p=0.027 n=10)

          │ /tmp/old.txt │          /tmp/new.txt          │
          │     B/op     │    B/op     vs base            │
Unique-24     160.0 ± 0%   160.0 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

          │ /tmp/old.txt │          /tmp/new.txt          │
          │  allocs/op   │ allocs/op   vs base            │
Unique-24     3.000 ± 0%   3.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal
```
2024-12-18 11:32:04 -05:00
Trevor Brown
a27ae46831 Merge pull request #90 from asdf-vm/tb/plugin-extension-commands
feat(golang-rewrite): implement asdf plugin extension commands
2024-12-18 11:32:04 -05:00
Your Name
369beebab9 feat(golang-rewrite): implement asdf plugin test command
* Enable `plugin_test_command.bats` tests
* Implement `asdf plugin test` command
2024-12-18 11:32:04 -05:00
Your Name
ccc98ad4e9 feat(golang-rewrite): implement asdf plugin extension commands
* Enable `plugin_extension_command.bats` tests
* Add comment on `version_commands.bats` tests
* Show help output when asdf run with no arguments
* Document breaking change in asdf extension commands feature
* Create `Plugin.ExtensionCommandPath` method
* Create `asdf cmd` subcommand
* Get `plugin_extension_command.bats` tests passing
* Document breaking changes to asdf extension commands
2024-12-18 11:32:04 -05:00
Trevor Brown
82f19436c8 Merge pull request #89 from asdf-vm/tb/plugin-list-all-tests
feat(golang-rewrite): implement `asdf plugin list all` command
2024-12-18 11:32:03 -05:00
Trevor Brown
5e542da7b5 Merge pull request #88 from asdf-vm/tb/install-command-tests
feat(golang-rewrite): get all `install_command.bats` tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
e7df5ff325 feat(golang-rewrite): implement asdf plugin list all command
* Enable `plugin_list_all_command.bats` tests
* Create `PluginIndex.Get` method
* Create `asdf plugin list all` subcommand
* Extract plugin index repo URL into config package
* Fix failing tests
2024-12-18 11:32:03 -05:00
Trevor Brown
609d60686b Merge pull request #87 from asdf-vm/tb/more-shim-exec-fixes-2
feat(golang-rewrite): get remaining `shim_exec.bats` tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
b6ec89f95f feat(golang-rewrite): get all install_command.bats tests passing
* Enable `install_command.bats` tests
* Update `versions.InstallVersion` function to accept `toolversions.Version` struct
* Remove download directory after install if not configured to keep it
* Add download callback requirement to list of breaking changes
* Add `--keep-download` flag to install command
* Get all `install_command.bats` tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
e8cde35779 Merge pull request #86 from asdf-vm/tb/more-shim-exec-fixes
feat(golang-rewrite): more shim exec fixes
2024-12-18 11:32:03 -05:00
Trevor Brown
162cb8ecee feat(golang-rewrite): get remaining shim_exec.bats tests passing
* Disable custom shim template tests
* Document another breaking change
* Enable `shim_exec.bats` tests
* Fix bug in `shims.getCustomExecutablePath` function
* Pass default relative executable path as third argument to `exec-path` callback
* Get remaining `shim_exec.bats` tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
03bd11f7cf Merge pull request #83 from asdf-vm/tb/shim-exec-fixes
fix(golang-rewrite): `asdf exec` and `asdf env` command fixes
2024-12-18 11:32:03 -05:00
Trevor Brown
f639f8a4d0 feat(golang-rewrite): more shim exec fixes
* Create `toolversions.ParseSlice` function
* Create `toolversions.Format` function
* Refactor `shims` package to use `toolversions.Version` struct
* Fix handling of path versions in `shims.FindExecutable` function
2024-12-18 11:32:03 -05:00
Trevor Brown
f01233eaee Merge pull request #82 from asdf-vm/tb/shim-exec-env
feat(golang-rewrite): implement `asdf env` command
2024-12-18 11:32:03 -05:00
Trevor Brown
7dfa8b40ae fix(golang-rewrite): asdf exec and asdf env command fixes
* Create `CurrentEnv` and `MergeEnv` helper functions
* Add another test for `paths.RemoveFromPath` function
* Move executable finding functions to shims package
* Correct PATH code for env and exec commands
2024-12-18 11:32:03 -05:00
Trevor Brown
0e43521ea7 Merge pull request #81 from asdf-vm/tb/reshim-fix
fix(golang-rewrite): allow directories returned by list-bin-paths to be absent from the file system
2024-12-18 11:32:03 -05:00
Trevor Brown
26a3815948 feat(golang-rewrite): implement asdf env command
* Create `CallbackPath` method on `Plugin` struct
* Correct behavior of `asdf shimversions` command
* Update `shims.FindExecutable` function to return plugin
* Create `repotest.WritePluginCallback` function
* Create `execenv` package for invoking `exec-env` plugin callback
* Make `MapToSlice` a public function
* Return resolved version from `shims.FindExecutable` function
* Create `shims.ExecutablePaths` function
* Enable `shim_env_command.bats` tests
* Implement `asdf env` command
2024-12-18 11:32:03 -05:00
Trevor Brown
20a7f851a0 Merge pull request #80 from asdf-vm/tb/asdf-version-info-fix-2
feat(golang-rewrite): correct asdf-version workflow step to produce version as output (second attempt)
2024-12-18 11:32:03 -05:00
Trevor Brown
80ac9bb51c fix(golang-rewrite): allow directories returned by list-bin-paths to be absent from the file system
* create `repotest.WritePluginCallback` function
* add test for `list-bin-paths` callback that returns non-existent path
* if directory name returned by `list-bin-paths` doesn't exist skip it
2024-12-18 11:32:03 -05:00
Trevor Brown
1d83d64203 Merge pull request #79 from asdf-vm/tb/asdf-version-info-fix
feat(golang-rewrite): correct asdf-version workflow step to produce version as output
2024-12-18 11:32:03 -05:00
Trevor Brown
572ed07f2b feat(golang-rewrite): correct asdf-version workflow step to produce version as output 2024-12-18 11:32:03 -05:00
Trevor Brown
8eeb85ddcc Merge pull request #78 from asdf-vm/tb/asdf-version-info
feat(golang-rewrite): compile asdf version into Go binaries
2024-12-18 11:32:03 -05:00
Trevor Brown
19a0597502 feat(golang-rewrite): correct asdf-version workflow step to produce version as output 2024-12-18 11:32:03 -05:00
Trevor Brown
c1d8975f88 Merge pull request #77 from asdf-vm/tb/shim-exec-bats
feat(golang-rewrite): introduce `Version` struct, get some `shim_exec.bats` tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
6d708b2807 feat(golang-rewrite): compile asdf version into Go binaries
* Create asdf-version script to print formatted version
* Update Makefile to set main.version variable during build
* Improve help output formatting
* Update release-build workflow to set asdf version in binaries
2024-12-18 11:32:03 -05:00
Trevor Brown
9d9fc698f4 Merge pull request #76 from asdf-vm/tb/shim-versions-command
feat(golang-rewrite): create shimversions command
2024-12-18 11:32:03 -05:00
Trevor Brown
924eecfa6a feat(golang-rewrite): introduce Version struct, get some shim_exec.bats tests passing
* Get more shim_exec.bats tests passing by adding shebang lines to test scripts
* Disable shim_exec test case for scenario that is no longer possible
* Add documentation on another breaking change
* Create toolversions.Version struct and update code to use new struct
2024-12-18 11:32:03 -05:00
Trevor Brown
5e61624690 Merge pull request #75 from asdf-vm/tb/upgrade-doc
feat(golang-rewrite): create version 0.14 to 0.15 upgrade guide
2024-12-18 11:32:03 -05:00
Trevor Brown
822e14c561 feat(golang-rewrite): create shimversions command
* Enable `shim_versions_command.bats` tests
* Create `asdf shimversions` command
2024-12-18 11:32:03 -05:00
Trevor Brown
7f4208333e Merge pull request #74 from asdf-vm/tb/remove-command-bats
feat(golang-rewrite): more `asdf plugin remove` tests
2024-12-18 11:32:03 -05:00
Trevor Brown
53cd454474 feat(golang-rewrite): create version 0.14 to 0.15 upgrade guide 2024-12-18 11:32:03 -05:00
Trevor Brown
626bde0a97 feat(golang-rewrite): more asdf plugin remove tests
* Enable `remove_command.bats` tests
* Update `remove_command.bats` to use new command name
* Create `internal/data` package
* Use data package for install paths
* Get all asdf plugin remove command BATS tests passing
2024-12-18 11:32:03 -05:00
Trevor Brown
5ec4dbfd70 Merge pull request #73 from asdf-vm/tb/asdf-list-commands
feat(golang-rewrite): create `asdf list` and `asdf list all` commands
2024-12-18 11:32:02 -05:00
Trevor Brown
a0b079c903 Merge pull request #72 from asdf-vm/tb/asdf-uninstall-command
feat(golang-rewrite): create `asdf uninstall` command
2024-12-18 11:32:02 -05:00
Trevor Brown
8db188a702 feat(golang-rewrite): create asdf list and asdf list all commands
* Enable `asdf list` BATS tests
* Update list_command.bats code to use non-hyphenated version of list all command
* Implement `asdf list all` command
* Implement `asdf list` command
2024-12-18 11:32:02 -05:00
Trevor Brown
0c27d88987 Merge pull request #71 from asdf-vm/tb/asdf-where-command
feat(golang-rewrite): create `asdf where` command
2024-12-18 11:32:02 -05:00
Trevor Brown
3fd4a83975 feat(golang-rewrite): create asdf uninstall command
* Enable asdf uninstall BATS tests
* Create `toolversions.ParseFromCliArg` function
* Create `versions.Uninstall` function
* Update `ParseFromCliArg` function to handle latest version without optional filter value
* Create `asdf uninstall` command
* Comment out invalid test
* Address linter warnings
2024-12-18 11:32:02 -05:00
Trevor Brown
ec8985af8f Merge pull request #70 from asdf-vm/tb/asdf-help-command
feat(golang-rewrite): implement `asdf help` command
2024-12-18 11:32:02 -05:00
Trevor Brown
09d06ff125 feat(golang-rewrite): create asdf where command
* Move `versions.ParseString` function to the toolversions package
* Create `toolversions.FormatForFS` function
* use new `toolversions.FormatForFS` function
* Create `asdf where` command
* Enable BATS tests for `asdf where` command
2024-12-18 11:32:02 -05:00
Trevor Brown
bfed008f3e Merge pull request #68 from asdf-vm/tb/which-command
feat(golang-rewrite): create `asdf which` command
2024-12-18 11:32:02 -05:00
Trevor Brown
d94baceb18 feat(golang-rewrite): implement asdf help command
* Create help package
* Add help command
* Enable help command BATS tests
* Implement functions in help package
* Write tests
* Correct function call in `installPlugin` test helper in shims package
2024-12-18 11:32:02 -05:00
Trevor Brown
87ac4bfe4c Merge pull request #69 from asdf-vm/tb/build-release-binaries
feat(golang-rewrite): build dev release binaries
2024-12-18 11:32:02 -05:00
Trevor Brown
d2afb85eb8 feat(golang-rewrite): create asdf which command
* create asdf which command
* enable which_command.bats tests
* add more info to NoExecutableForPluginError
* Write tests for shims.GetExecutablePath function
* Use plugin `exec-path` callback when present to compute executable
path
2024-12-18 11:32:02 -05:00
Trevor Brown
e7268576ee Merge pull request #67 from asdf-vm/tb/current-command
feat(golang-rewrite): create `asdf current` command
2024-12-18 11:32:02 -05:00
Trevor Brown
bc05110159 feat(golang-rewrite): build dev release binaries
* Use `wangyoucao577/go-release-action@v1` to build Go binaries for releases
* set release tag for `go-release-action`
2024-12-18 11:32:02 -05:00
Trevor Brown
6c4df2af42 Merge pull request #66 from asdf-vm/tb/shim-exec-2
feat(golang-rewrite): create `asdf exec` command
2024-12-18 11:32:02 -05:00
Trevor Brown
b33ab6463c feat(golang-rewrite): create asdf current command
* Create asdf current command
* Correct output of asdf exec command when no command is provided
* Enable current_command.bats tests
* Fix current_command.bats test code
2024-12-18 11:32:02 -05:00
Trevor Brown
05b9c37232 Merge pull request #65 from asdf-vm/tb/shim-exec-1
feat(golang-rewrite): create `shims.FindExecutable` function for shim execution
2024-12-18 11:32:02 -05:00
Trevor Brown
b966ca6627 feat(golang-rewrite): create asdf exec command
* Add `rogpeppe/go-internal` as a dependency
* Create `exec.Exec` function
* Create asdf exec command
* Address linter warnings
2024-12-18 11:32:02 -05:00
Trevor Brown
631b0d8793 Merge pull request #64 from asdf-vm/tb/shim-generation-4
feat(golang-rewrite): use version type when generating shims
2024-12-18 11:32:02 -05:00
Trevor Brown
9f09f78ec0 feat(golang-rewrite): create shims.FindExecutable function for shim execution
* Create primitive `toolversions.Intersect` function
* Create `paths.RemoveFromPath` function
* Create `shims.FindExecutable` function
* Write tests
2024-12-18 11:32:02 -05:00
Trevor Brown
eb0e475772 Merge pull request #63 from asdf-vm/tb/shim-generation-3
feat(golang-rewrite): create installs and installtest packages to avoid circular dependency
2024-12-18 11:32:02 -05:00
Trevor Brown
5266ba581d feat(golang-rewrite): use version type when generating shims
* Generate shims after version install
* Enable `reshim_command.bats` tests
* Remove `update_command.bats` tests from main_test.go
* Update `installs` package functions to accept version type in addition to version value
* Update `versions.ParseString` function to handle path version
* Move invocation of hooks for reshim
* Update `asdf reshim` command so shims can be generated for path versions
2024-12-18 11:32:02 -05:00
Trevor Brown
05e0a4a57f Merge pull request #62 from asdf-vm/tb/reorganize-go-code
feat(golang-rewrite): re-organize Go code
2024-12-18 11:32:02 -05:00
Trevor Brown
be52d8f39c feat(golang-rewrite): create installs and installtest packages to avoid circular dependency
* Correct `go test` command in GitHub test workflow
* Update execute tests to work on Github Actions
* Check in `shims/testdata` directory
* Create `installtest` helper package
* Create `installs` package
2024-12-18 11:32:02 -05:00
Trevor Brown
74d741fc3f Merge pull request #61 from asdf-vm/tb/shim-generation-2
feat(golang-rewrite): shim generation 2
2024-12-18 11:32:02 -05:00
Trevor Brown
620c0d87e8 feat(golang-rewrite): re-organize Go code
* move most Go packages to internal directory
* update import paths
2024-12-18 11:32:02 -05:00
Trevor Brown
62c2ba18f4 Merge pull request #60 from asdf-vm/tb/shim-generation
feat(golang-rewrite): shim generation part 1
2024-12-18 11:32:02 -05:00
Trevor Brown
985c181118 feat(golang-rewrite): shim generation 2
* Rename `versions.Installed` function to `IsInstalled`
* Create `versions.Installed` function
* Create `shims.GenerateForPluginVersions` and `shims.GenerateAll` functions
* Address linter warnings
* Create asdf reshim command
* Run asdf hook from new `shims` functions
2024-12-18 11:32:02 -05:00
Trevor Brown
241485016d Merge pull request #59 from asdf-vm/tb/install-cmd-bats-tests
feat(golang-rewrite): more work to get `install_command.bats` test passing
2024-12-18 11:32:02 -05:00
Trevor Brown
18e21c9028 feat(golang-rewrite): shim generation part 1
* Add `x/sys` as a dependency
* Create `toolversions.Unique` function
* Create `shims` package with `ExecutablePaths`, `PluginExecutables`, `Write`, `GenerateForVersion` function
* Address linter warnings
2024-12-18 11:32:02 -05:00
Trevor Brown
c0963a38a6 feat(golang-rewrite): more work to get install_command.bats test passing
* Correct `logger.Printf` call
* Get `plugin_remove_command.bats` tests passing
* Enable plugin_remove_command BATS tests
* Create `versions.NoVersionSetError` struct
* Set `ASDF_CONCURRENCY` for install callbacks
2024-12-18 11:32:02 -05:00
Trevor Brown
99cabeaf37 Merge pull request #58 from asdf-vm/tb/bats-test-fixes
feat(golang-rewrite): BATS test fixes & `latest` command
2024-12-18 11:32:01 -05:00
Trevor Brown
45461e07ef Merge pull request #57 from asdf-vm/tb/install-command
feat(golang-rewrite): create install command
2024-12-18 11:32:01 -05:00
Trevor Brown
b23e5a320f feat(golang-rewrite): BATS test fixes & latest command
* Get asdf info BATS tests working
* Create `versions.Installed` function
* Update `versions.Latest` to return single version
* Implement `latest` asdf command
2024-12-18 11:32:01 -05:00
Trevor Brown
123162946c Merge pull request #56 from asdf-vm/tb/latest-version
feat(golang-rewrite): create versions.Latest function
2024-12-18 11:32:01 -05:00
Trevor Brown
8313ebca2d feat(golang-rewrite): create install command
* Create `versions.Install` function
* Create `versions.InstallVersion` function
* Create `versions.InstallAll` function
* Improve tests
* Create install command
2024-12-18 11:32:01 -05:00
Trevor Brown
a94d8a87fa Merge pull request #54 from asdf-vm/tb/asdf-install-cmd
feat(golang-rewrite): create `versions.InstallOneVersion` function
2024-12-18 11:32:01 -05:00
Trevor Brown
9f6a65f5dd feat(golang-rewrite): create versions.Latest function
* Create `versions.ListAll` function
* Create `versions.Latest` function
* Update `versions.InstallOneVersion` to install latest version
2024-12-18 11:32:01 -05:00
Trevor Brown
ef91474538 Merge pull request #53 from asdf-vm/tb/full-version-resolution
feat(golang-rewrite): full version resolution
2024-12-18 11:32:01 -05:00
Trevor Brown
65688915a5 feat(golang-rewrite): create versions.InstallOneVersion function
* Create Plugin.Exists method
* Create internal/versions package
* Add missing asdfrc for internal/resolve package tests
* Create versions.ParseString function
* Create versions.InstallOneVersion function
* Update hook package to allow hook output to be received
* Write tests
2024-12-18 11:32:01 -05:00
Trevor Brown
13fbec2ad8 Merge pull request #52 from asdf-vm/tb/version-resolution
feat(golang-rewrite): create internal/resolve package
2024-12-18 11:32:01 -05:00
Trevor Brown
bd7ab9ae08 feat(golang-rewrite): full version resolution
* Refactor config package so default settings are always used with config file not loaded
* Update `findVersionsInDir` to check legacy files
* Refactor functions in internal/resolve package to return `ToolVersion` structs instead of version slices
* Refactor `findVersionsInEnv` function to return env variable name
* Create `resolve.Version` function
2024-12-18 11:32:01 -05:00
Trevor Brown
daba8249a2 Merge pull request #51 from asdf-vm/tb/offline-tests
feat(golang-rewrite): offline Go tests
2024-12-18 11:32:01 -05:00
Trevor Brown
c2e5ee6525 feat(golang-rewrite): create internal/resolve package
* Create `resolve` package
* Create `FindVersionsInDir`, `findVersionsInEnv`, and `findVersionsInLegacyFile` functions in resolve package
* Create `LegacyFilenames` and `ParseLegacyVersionFile` methods for Plugin
2024-12-18 11:32:01 -05:00
Trevor Brown
2e185a0e5b Merge pull request #50 from asdf-vm/tb/version-file-parsing
feat(golang-rewrite): version file parsing
2024-12-18 11:32:01 -05:00
Trevor Brown
f74efbf1bf feat(golang-rewrite): offline Go tests
Some of the Go tests actually cloned remote repos, which meant slow tests, and tests failures if I was working offline. These changes allow all Go tests to run offline. The test code now clones local Git repos instead of remotes ones.

* Add otiai10/copy as a dependency
* Create repotest package for test code that needs to work with Git repos
* Add back missing test script for execute package
* Update git, pluginindex, and plugins package tests so they work offline
2024-12-18 11:32:01 -05:00
Trevor Brown
160ca04444 Merge pull request #49 from asdf-vm/tb/info-command
feat(golang-rewrite): info command
2024-12-18 11:32:01 -05:00
Trevor Brown
3155dc374e feat(golang-rewrite): version file parsing
* Create toolversions package
* Address linter errors for toolversions package
* Write tests
2024-12-18 11:32:01 -05:00
Trevor Brown
516be76ad5 Merge pull request #48 from asdf-vm/tb/plugin-callback-invocation
feat(golang-rewrite): create `RunCallback` method for `Plugin` struct
2024-12-18 11:32:01 -05:00
Trevor Brown
447acd13d1 feat(golang-rewrite): info command
* Implement info command
* Remove duplicate and unneeded BATS tests from `main_test.go`
* remove download dir for plugin when removing plugin
* update plugins.Add function so downloads directory is created
2024-12-18 11:32:01 -05:00
Trevor Brown
963c04c742 Merge pull request #45 from asdf-vm/tb/command-exec
feat(golang-rewrite): create hooks
2024-12-18 11:32:01 -05:00
Trevor Brown
778ab34a6f feat(golang-rewrite): create RunCallback method for Plugin struct
* Create `plugins.New` function, updating existing code to use it
* Add another test for `hook.Run` function
* Enable `plugin_add_command.bats` tests for Go implementation of asdf
* Add `RunCallback` method to `Plugin` struct
* Update `plugins.Add` function to run `post-plugin-add` plugin callback script
* Handle Bash expression and scripts properly in `execute` package so `$@` is always set
2024-12-18 11:32:01 -05:00
Trevor Brown
cb813f65ef Merge pull request #44 from asdf-vm/tb/use-plugin-index
feat(golang-rewrite): use plugin index
2024-12-18 11:32:01 -05:00
Trevor Brown
771f18493f feat(golang-rewrite): create hooks
* Update tests for config package to use assert package
* Create Config.GetHook method
* Create execute package for running Bash commands
* Create hook package for running asdf hooks
* Run plugin add hooks
2024-12-18 11:32:01 -05:00
Trevor Brown
a5d7ebf8bc Merge pull request #42 from asdf-vm/tb/git-code-refactor
feat(golang-rewrite): move all Git code to git package
2024-12-18 11:32:01 -05:00
Trevor Brown
8394e858fe feat(golang-rewrite): use plugin index
* Create `pluginindex.Build` function
* Use `pluginindex` when no plugin URL provided for plugin add command
* Get more `plugin_add_command` BATS tests passing against Golang version
* Only use `pluginindex` when it is not disabled
* Update error message so it matches legacy format
* Add staticcheck.conf
2024-12-18 11:32:01 -05:00
Trevor Brown
89ec687da9 Merge pull request #40 from asdf-vm/tb/plugin-repository
feat(golang-rewrite): create pluginindex package
2024-12-18 11:32:01 -05:00
Trevor Brown
cb49b64a5a feat(golang-rewrite): move all Git code to git package
* Move plugins/git package to /git.
* Update repoer interface in pluginindex package to match interface in git package
* Use git package's Repo struct in pluginindex package
2024-12-18 11:32:01 -05:00
Trevor Brown
0aba948c65 Merge pull request #36 from asdf-vm/tb/plugin-update-cmd
feat(golang-rewrite): create plugin update command
2024-12-18 11:32:01 -05:00
Trevor Brown
202cdae831 feat(golang-rewrite): create pluginindex package
* Switch to non-verbose test output in Makefile
* Create pluginindex package with PluginIndex struct with methods for updating index and retrieving plugin URLs
* Create IndexRepo interface to allow for easy testing out cloning real Git repository.
2024-12-18 11:32:01 -05:00
Trevor Brown
c4800443bd feat(golang-rewrite): create plugin update command 2024-12-18 11:32:01 -05:00
Trevor Brown
a6a27e4812 Merge pull request #38 from asdf-vm/tb/setup-gofumpt
chore(golang-rewrite): setup gofumpt
2024-12-18 11:32:00 -05:00
Trevor Brown
636620524e Merge pull request #35 from asdf-vm/tb/plugin-git-package
feat(golang-rewrite): create plugins/git package to store plugin Git operations
2024-12-18 11:32:00 -05:00
Trevor Brown
c85155f69d chore(golang-rewrite): setup gofumpt
* Install and run gofumpt in Golang lint workflow
* Remove golangci-lint
* Run gofumpt and fix revive linter errors
2024-12-18 11:32:00 -05:00
Trevor Brown
3ffeec2ea0 Merge pull request #33 from asdf-vm/tb/default-config-refactor
chore(golang-rewrite): default settings refactor
2024-12-18 11:32:00 -05:00
Trevor Brown
325cd3334b feat(golang-rewrite): create plugins/git package to store plugin Git operations 2024-12-18 11:32:00 -05:00
Trevor Brown
e4c2b482a6 chore(golang-rewrite): rename files for plugins and cmd packages 2024-12-18 11:32:00 -05:00
Trevor Brown
0ce1de3834 chore(golang-rewrite): default settings refactor 2024-12-18 11:32:00 -05:00
Trevor Brown
037cf36dab Merge pull request #32 from asdf-vm/tb/workflow-improvements
chore(golang-rewrite): Github workflow improvements
2024-12-18 11:32:00 -05:00
Trevor Brown
c10d22fa27 Merge pull request #31 from asdf-vm/tb/add-makefile
feat(golang-rewrite): create Makefile
2024-12-18 11:32:00 -05:00
Trevor Brown
5406f3eca1 chore(golang-rewrite): Github workflow improvements
* Add golangci-lint to lint workflow
* Remove failing Bash test jobs
* Add golangci lint config
* Fix revive command in Makefile
* Fix revive warnings
2024-12-18 11:32:00 -05:00
Trevor Brown
a3f16b24a1 Merge pull request #30 from asdf-vm/tb/plugin-remove-command
feat(golang-rewrite): create plugin remove command
2024-12-18 11:32:00 -05:00
Trevor Brown
9097696a4f feat(golang-rewrite): create Makefile
* Address Go linter warnings
* Fix Github workflow
2024-12-18 11:32:00 -05:00
Trevor Brown
4741147821 Merge pull request #29 from asdf-vm/tb/plugin-list-command
feat(golang-rewrite): create plugin list command
2024-12-18 11:32:00 -05:00
Trevor Brown
2b02f51fa1 feat(golang-rewrite): create plugin remove command
* Simplify BATS test Golang code
* Update plugin add test to new command format
* Correctly set `ASDF_DATA_DIR` for BATS tests
* Rename `PluginAdd` function to `Add`
* Create `plugin.Remove` function
* Make plugin remove command invoke `plugin.Remove` function
2024-12-18 11:32:00 -05:00
Trevor Brown
b49e01beee Merge pull request #28 from asdf-vm/tb/plugin-add-command-2
feat(golang-rewrite): create pluginAddCommand function for plugin add command action
2024-12-18 11:32:00 -05:00
Trevor Brown
ad0907a74d feat(golang-rewrite): create plugin list command
* remove underscores from function names (addresses warnings from revive linter)
* create installMockPluginRepo function
* implement plugin list command
2024-12-18 11:32:00 -05:00
Trevor Brown
43f20587b5 Merge pull request #26 from asdf-vm/tb/plugin-add-command
feat(golang-rewrite): PluginAdd function
2024-12-18 11:32:00 -05:00
Trevor Brown
26b91aa828 feat(golang-rewrite): create pluginAddCommand function for plugin add command action 2024-12-18 11:32:00 -05:00
Trevor Brown
f9e25b06fb Merge pull request #25 from asdf-vm/tb/plugin-command-placeholders
feat(golang-rewrite): add placeholders for plugin subcommands
2024-12-18 11:32:00 -05:00
Trevor Brown
15e1f06f37 feat(golang-rewrite): PluginAdd function
* Add go-git as a dependency
* Remove plugins dir from gitignore
* Move config code to config package
* Create validatePluginName function
* Create PluginDirectory function
* Create PluginExists function
* Implement PluginAdd function
* Add testify as a dependency
* Write test for PluginAdd happy path
2024-12-18 11:32:00 -05:00
Trevor Brown
faa56e4eb2 Merge pull request #24 from asdf-vm/tb/config-api
feat(golang-rewrite): add config methods
2024-12-18 11:32:00 -05:00
Trevor Brown
b40beb6039 feat(golang-rewrite): add placeholders for plugin subcommands
* Switch from cobra to urfave/cli
* Create placeholder plugin command structs
2024-12-18 11:32:00 -05:00
Trevor Brown
60207d8a6e Merge pull request #16 from asdf-vm/dependabot/github_actions/actions/checkout-4
chore(deps): bump actions/checkout from 3 to 4
2024-12-18 11:32:00 -05:00
Trevor Brown
8ad3472abc feat(golang-rewrite): add config methods
* Create PluginRepoCheckDuration struct to represent config value
* Make some functions private
* write basic tests for Config methods
* Add Loaded field to Settings struct
* Define constants for config default values
2024-12-18 11:32:00 -05:00
Trevor Brown
6b5f3624c0 Merge pull request #23 from asdf-vm/tb/setup-config
feat(golang-rewrite): create settings and config structs for loading config
2024-12-18 11:32:00 -05:00
dependabot[bot]
57f2c97f86 chore(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-18 11:32:00 -05:00
Trevor Brown
f0cb04c91a Merge pull request #22 from asdf-vm/tb/workflow-fix
fix(golang-rewrite): update detect-changes logic for Golang tests
2024-12-18 11:32:00 -05:00
Trevor Brown
07b5813566 feat(golang-rewrite): create settings and config structs for loading config
* rename commands package to cmd
* add go-ini as a dependency
* write code to parse asdfrc file into Settings struct
* add go-envconfig as a dependency
* add go-homedir as a dependency
* implement first version of LoadConfig function to load environment variables into Config struct
2024-12-18 11:32:00 -05:00
Trevor Brown
e19fb9e276 Merge pull request #21 from asdf-vm/tb/cli-arg-parsing
feat(golang-rewrite): setup Cobra for command line interface
2024-12-18 11:32:00 -05:00
Trevor Brown
88af4eea00 fix(golang-rewrite): update detect-changes logic for Golang tests 2024-12-18 11:32:00 -05:00
Trevor Brown
5105fbf824 Merge pull request #20 from asdf-vm/tb/bats-tests-golang
feat(golang-rewrite): run BATS integration tests for Golang implementation
2024-12-18 11:32:00 -05:00
Trevor Brown
d06d71f9f6 feat(golang-rewrite): add boilerplate for cobra CLI commands 2024-12-18 11:32:00 -05:00
Trevor Brown
5db7d3181c Merge pull request #19 from asdf-vm/tb/attempt-to-fix-goreleaser-3
fix(golang-rewrite): attempt to fix goreleaser GitHub workflow
2024-12-18 11:32:00 -05:00
Trevor Brown
163d6b4b46 fix(golang-rewrite): comment out all BATS tests 2024-12-18 11:32:00 -05:00
Trevor Brown
7d5281a8a9 feat(golang-rewrite): add cobra library as dependency 2024-12-18 11:32:00 -05:00
Trevor Brown
04f9c5fe7d Merge pull request #15 from asdf-vm/tb/attempt-to-fix-goreleaser-2
fix(golang-rewrite): try to get goreleaser action to generate snapsho…
2024-12-18 11:32:00 -05:00
Trevor Brown
1b3c42699a fix(golang-rewrite): attempt to fix goreleaser GitHub workflow 2024-12-18 11:32:00 -05:00
Trevor Brown
3f17a80fbe fix(golang-rewrite): fix dependencies script on linux 2024-12-18 11:32:00 -05:00
Trevor Brown
cfc473fb5c Merge pull request #14 from asdf-vm/tb/attempt-to-fix-goreleaser
fix(golang-rewrite): try to fix goreleaser
2024-12-18 11:32:00 -05:00
Trevor Brown
7439ea9168 fix(golang-rewrite): try to get goreleaser action to generate snapshot builds 2024-12-18 11:32:00 -05:00
Trevor Brown
f5a59677df feat(golang-rewrite): make bats available for golang tests 2024-12-18 11:32:00 -05:00
Trevor Brown
ae0d271861 Merge pull request #13 from asdf-vm/tb/workflow-jobs-fix
fix(golang-rewrite): set dependencies between release-build jobs
2024-12-18 11:32:00 -05:00
Trevor Brown
2a31cafd38 fix(golang-rewrite): try to fix goreleaser 2024-12-18 11:32:00 -05:00
Trevor Brown
2951011090 feat(golang-rewrite): set variables for bats integration tests 2024-12-18 11:32:00 -05:00
Trevor Brown
477e9d5729 feat(golang-rewrite): build golang asdf for BATS integration tests 2024-12-18 11:32:00 -05:00
Trevor Brown
2fc8006490 feat(golang-rewrite): run bats integration tests in golang 2024-12-18 11:32:00 -05:00
Trevor Brown
f18873bf86 Merge pull request #12 from asdf-vm/tb/golang-build-fix
fix(golang-rewrite): add missing goreleaser argument
2024-12-18 11:31:59 -05:00
Trevor Brown
6b45a5e5f7 fix(golang-rewrite): set dependencies between release-build jobs 2024-12-18 11:31:59 -05:00
Trevor Brown
99dc28cbf7 Merge pull request #11 from asdf-vm/tb/golang-builds
feat(golang-rewrite): setup Golang CI builds
2024-12-18 11:31:59 -05:00
Trevor Brown
5a24864632 fix(golang-rewrite): add missing goreleaser argument 2024-12-18 11:31:59 -05:00
Trevor Brown
814c1fa3e7 Merge pull request #8 from asdf-vm/tb/github-workflow-setup
feat: Add Golang checks to GitHub workflows
2024-12-18 11:31:59 -05:00
Trevor Brown
87d3c06cf5 fix(golang-rewrite): correct go build command in lint workflow 2024-12-18 11:31:59 -05:00
Trevor Brown
5c85efbc37 Merge pull request #5 from asdf-vm/tb/initialize-go-project
feat(golang-rewrite): initialize golang module
2024-12-18 11:31:59 -05:00
Trevor Brown
3a9f539aa0 feat: add Golang tests to GitHub test workflow 2024-12-18 11:31:59 -05:00
Trevor Brown
c5092c6dbf feat(golang-rewrite): setup Golang release GitHub workflow 2024-12-18 11:31:59 -05:00
Trevor Brown
7bee8de060 Merge pull request #1 from asdf-vm/dependabot/github_actions/GoogleCloudPlatform/release-please-action-4
chore(deps): bump GoogleCloudPlatform/release-please-action from 3 to 4
2024-12-18 11:31:59 -05:00
Trevor Brown
72c20b1b51 feat(golang-rewrite): initialize golang module 2024-12-18 11:31:59 -05:00
Trevor Brown
f41ce90dc4 feat: add linting for Golang to GitHub lint workflow 2024-12-18 11:31:59 -05:00
Trevor Brown
3f9744df0f feat(golang-rewrite): setup goreleaser 2024-12-18 11:31:59 -05:00
dependabot[bot]
140ad3a48c chore(deps): bump GoogleCloudPlatform/release-please-action from 3 to 4
Bumps [GoogleCloudPlatform/release-please-action](https://github.com/googlecloudplatform/release-please-action) from 3 to 4.
- [Release notes](https://github.com/googlecloudplatform/release-please-action/releases)
- [Changelog](https://github.com/google-github-actions/release-please-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googlecloudplatform/release-please-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: GoogleCloudPlatform/release-please-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-18 11:31:59 -05:00
Trevor Brown
3e11bd4b33 fix: update GitHub workflows to work private asdf Go fork 2024-12-18 11:31:59 -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
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
16 changed files with 529 additions and 27 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

@ -2,6 +2,7 @@
package cli
import (
_ "embed"
"errors"
"fmt"
"io"
@ -71,6 +72,13 @@ func Execute(version string) {
return extensionCommand(logger, args)
},
},
{
Name: "completion",
Action: func(cCtx *cli.Context) error {
shell := cCtx.Args().Get(0)
return completionCommand(logger, shell)
},
},
{
Name: "current",
Flags: []cli.Flag{
@ -307,6 +315,47 @@ func Execute(version string) {
}
}
//go:embed completions/asdf.bash
var bashCompletions string
//go:embed completions/asdf.zsh
var zshCompletions string
//go:embed completions/asdf.fish
var fishCompletions string
//go:embed completions/asdf.nu
var nuCompletions string
//go:embed completions/asdf.elv
var elvishCompletions string
func completionCommand(l *log.Logger, shell string) error {
switch shell {
case "bash":
fmt.Print(bashCompletions)
return nil
case "zsh":
fmt.Print(zshCompletions)
return nil
case "fish":
fmt.Print(fishCompletions)
return nil
case "nushell":
fmt.Print(nuCompletions)
return nil
case "elvish":
fmt.Print(elvishCompletions)
return nil
default:
fmtString := `No completions available for shell with name %s
Completions are available for: bash, zsh, fish, nushell, elvish`
msg := fmt.Sprintf(fmtString, shell)
l.Print(msg)
return errors.New(msg)
}
}
// This function is a whole mess and needs to be refactored
func currentCommand(logger *log.Logger, tool string, noHeader bool) error {
conf, err := config.LoadConfig()

148
cli/completions/asdf.elv Normal file
View File

@ -0,0 +1,148 @@
# Setup argument completions
fn arg-completer {|@argz|
set argz = $argz[1..-1] # strip 'asdf' and trailing empty string
var num = (count $argz)
if (== $num 0) {
# list all subcommands
find $asdf_dir'/lib/commands' -name 'command-*' | each {|cmd|
put (re:replace '.*/command-(.*)\.bash' '${1}' $cmd)
}
put 'plugin'
} else {
if (match $argz 'current') {
# asdf current <name>
asdf plugin-list
} elif (match $argz 'env') {
# asdf env <command>
ls-shims
} elif (match $argz 'env' '.*') {
# asdf env <command> [util]
ls-executables
} elif (match $argz 'exec') {
# asdf exec <command>
ls-shims
} elif (match $argz 'global') {
# asdf global <name>
asdf plugin-list
} elif (match $argz 'global' '.*') {
# asdf global <name> <version>
ls-installed-versions $argz[-1]
} elif (match $argz 'install') {
# asdf install <name>
asdf plugin-list
} elif (match $argz 'install' '.*') {
# asdf install <name> <version>
ls-all-versions $argz[-1]
} elif (match $argz 'install' '.*' '.*') {
# asdf install <name> <version> [--keep-download]
put '--keep-download'
} elif (match $argz 'latest') {
# asdf latest <name>
asdf plugin-list
} elif (match $argz 'latest' '.*') {
# asdf latest <name> [<version>]
ls-all-versions $argz[-1]
} elif (match $argz 'list-all') {
# asdf list all <name>
asdf plugin-list
} elif (match $argz 'list-all' '.*') {
# asdf list all <name> [<version>]
ls-all-versions $argz[-1]
} elif (match $argz 'list') {
# asdf list <name>
asdf plugin-list
} elif (match $argz 'list' '.*') {
# asdf list <name> [<version>]
ls-installed-versions $argz[-1]
} elif (match $argz 'local') {
# asdf local <name> [-p|--parent]
asdf plugin-list
put '-p'
put '--parent'
} elif (match $argz 'local' '(-p|(--parent))') {
# asdf local <name> [-p|--parent] <version>
asdf plugin-list
} elif (match $argz 'local' '.*') {
# asdf local <name> [-p|--parent]
# asdf local <name> <version>
ls-installed-versions $argz[-1]
put '-p'
put '--parent'
} elif (match $argz 'local' '(-p|(--parent))' '.*') {
# asdf local [-p|--parent] <name> <version>
ls-installed-versions $argz[-1]
} elif (match $argz 'local' '.*' '(-p|(--parent))') {
# asdf local <name> [-p|--parent] <version>
ls-installed-versions $argz[-2]
} elif (match $argz 'local' '.*' '.*') {
# asdf local <name> <version> [-p|--parent]
put '-p'
put '--parent'
} elif (or (match $argz 'plugin-add') (match $argz 'plugin' 'add')) {
# asdf plugin add <name>
asdf plugin-list-all | each {|line|
put (re:replace '([^\s]+)\s+.*' '${1}' $line)
}
} elif (or (match $argz 'plugin-list') (match $argz 'plugin' 'list')) {
# asdf plugin list
put '--urls'
put '--refs'
put 'all'
} elif (or (match $argz 'plugin-push') (match $argz 'plugin' 'push')) {
# asdf plugin push <name>
asdf plugin-list
} elif (or (match $argz 'plugin-remove') (match $argz 'plugin' 'remove')) {
# asdf plugin remove <name>
asdf plugin-list
} elif (and (>= (count $argz) 3) (match $argz[..3] 'plugin-test' '.*' '.*')) {
# asdf plugin-test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]
put '--asdf-plugin-gitref'
put '--asdf-tool-version'
ls-executables
ls-shims
} elif (and (>= (count $argz) 4) (match $argz[..4] 'plugin' 'test' '.*' '.*')) {
# asdf plugin test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]
put '--asdf-plugin-gitref'
put '--asdf-tool-version'
ls-executables
ls-shims
} elif (or (match $argz 'plugin-update') (match $argz 'plugin' 'update')) {
# asdf plugin update <name>
asdf plugin-list
put '--all'
} elif (match $argz 'plugin') {
# list plugin-* subcommands
find $asdf_dir'/lib/commands' -name 'command-plugin-*' | each {|cmd|
put (re:replace '.*/command-plugin-(.*)\.bash' '${1}' $cmd)
}
} elif (match $argz 'reshim') {
# asdf reshim <name>
asdf plugin-list
} elif (match $argz 'reshim' '.*') {
# asdf reshim <name> <version>
ls-installed-versions $argz[-1]
} elif (match $argz 'shim-versions') {
# asdf shim-versions <command>
ls-shims
} elif (match $argz 'uninstall') {
# asdf uninstall <name>
asdf plugin-list
} elif (match $argz 'uninstall' '.*') {
# asdf uninstall <name> <version>
ls-installed-versions $argz[-1]
} elif (match $argz 'update') {
if (== $num 1) {
# asdf update
put '--head'
}
} elif (match $argz 'where') {
# asdf where <name>
asdf plugin-list
} elif (match $argz 'where' '.*') {
# asdf where <name> [<version>]
ls-installed-versions $argz[-1]
} elif (match $argz 'which') {
ls-shims
}
}
}

250
cli/completions/asdf.nu Normal file
View File

@ -0,0 +1,250 @@
module asdf {
def "complete asdf sub-commands" [] {
[
"plugin",
"list",
"install",
"uninstall",
"current",
"where",
"which",
"local",
"global",
"shell",
"latest",
"help",
"exec",
"env",
"info",
"reshim",
"shim-version",
"update"
]
}
def "complete asdf installed" [] {
^asdf plugin list | lines | each { |line| $line | str trim }
}
def "complete asdf plugin sub-commands" [] {
[
"list",
"list all",
"add",
"remove",
"update"
]
}
def "complete asdf installed plugins" [] {
^asdf plugin list | lines | each { |line|
$line | str trim
}
}
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"
]
# Manage plugins
export extern "asdf plugin" [
subcommand?: string@"complete asdf plugin sub-commands"
]
# List installed plugins
export def "asdf plugin list" [
--urls # Show urls
--refs # Show refs
] {
let params = [
{name: 'urls', enabled: $urls, flag: '--urls',
template: '\s+?(?P<repository>(?:http[s]?|git).+\.git|/.+)'}
{name: 'refs', enabled: $refs, flag: '--refs',
template: '\s+?(?P<branch>\w+)\s+(?P<ref>\w+)'}
]
let template = '(?P<name>.+)' + (
$params |
where enabled |
get --ignore-errors template |
str join '' |
str trim
)
let flags = ($params | where enabled | get --ignore-errors flag | default '' )
^asdf plugin list ...$flags | lines | parse -r $template | str trim
}
# list all available plugins
export def "asdf plugin list all" [] {
let template = '(?P<name>.+)\s+?(?P<installed>[*]?)(?P<repository>(?:git|http|https).+)'
let is_installed = { |it| $it.installed == '*' }
^asdf plugin list all |
lines |
parse -r $template |
str trim |
update installed $is_installed |
sort-by name
}
# Add a plugin
export extern "asdf plugin add" [
name: string # Name of the plugin
git_url?: string # Git url of the plugin
]
# Remove an installed plugin and their package versions
export extern "asdf plugin remove" [
name: string@"complete asdf installed plugins" # Name of the plugin
]
# Update a plugin
export extern "asdf plugin update" [
name: string@"complete asdf installed plugins" # Name of the plugin
git_ref?: string # Git ref to update the plugin
]
# Update all plugins to the latest commit
export extern "asdf plugin update --all" []
# install a package version
export extern "asdf install" [
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@"complete asdf plugin versions installed" # Version of the package
]
# Display current version
export extern "asdf current" [
name?: string@"complete asdf installed" # Name of installed version of a package
]
# Display path of an executable
export extern "asdf which" [
command: string # Name of command
]
# Display install path for an installled package version
export extern "asdf where" [
name: string@"complete asdf installed" # Name 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@"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@"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@"complete asdf plugin versions installed" # Version of the package or latest
]
# Show latest stable version of a package
export extern "asdf latest" [
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
export extern "asdf latest --all" []
# List installed package versions
export extern "asdf list" [
name?: string@"complete asdf installed" # Name of the package
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@"complete asdf plugin versions installed"="" # Filter the version
] {
^asdf list all $name $version | lines | parse "{version}" | str trim
}
# Show documentation for plugin
export extern "asdf help" [
name: string@"complete asdf installed" # Name of the plugin
version?: string@"complete asdf plugin versions installed" # Version of the plugin
]
# Execute a command shim for the current version
export extern "asdf exec" [
command: string # Name of the command
...args: any # Arguments to pass to the command
]
# Run util (default: env) inside the environment used for command shim execution
export extern "asdf env" [
command?: string # Name of the command
util?: string = 'env' # Name of util to run
]
# Show information about OS, Shell and asdf Debug
export extern "asdf info" []
# Recreate shims for version package
export extern "asdf reshim" [
name?: string@"complete asdf installed" # Name of the package
version?: string@"complete asdf plugin versions installed" # Version of the package
]
# List the plugins and versions that provide a command
export extern "asdf shim-version" [
command: string # Name of the command
]
# Update asdf to the latest version on the stable branch
export extern "asdf update" []
# Update asdf to the latest version on the main branch
export extern "asdf update --head" []
}
use asdf *

View File

@ -1,4 +1,5 @@
#compdef asdf
compdef _asdf asdf
#description tool to manage versions of multiple runtimes
local curcontext="$curcontext" state state_descr line subcmd
@ -90,6 +91,7 @@ _asdf__installed_versions_of_plus_system() {
compadd -a versions
}
_asdf() {
local -i IntermediateCount=0
@ -117,6 +119,8 @@ _asdf__dash_commands() {
subcmd="${subcmd}-${words[2+IntermediateCount]}"
fi
}
case "$subcmd" in
(plugin|shim|list)
_asdf__dash_commands
@ -220,3 +224,4 @@ case "$subcmd" in
(( CURRENT == 3 )) && compadd -- --head
;;
esac
}

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

@ -1,6 +1,6 @@
# Upgrading From Version 0.14.x to 0.15.0
# Upgrading From Version 0.15.x to 0.16.0
asdf versions 0.14.1 and older were written in Bash and distributed as a set of
asdf versions 0.15.0 and older were written in Bash and distributed as a set of
Bash scripts with the `asdf` function loaded into your shell. asdf version
0.15.0 is a complete rewrite of asdf in Go. Since it is a complete rewrite
there are a number of breaking changes and it is now distributed as a binary
@ -15,7 +15,7 @@ callback any installs of any version of that plugin will fail.
### Hyphenated commands have been removed
asdf version 0.14.1 and earlier supported by hyphenated and non-hyphenated
asdf version 0.15.0 and earlier supported by hyphenated and non-hyphenated
versions of certain commands. With version 0.15.0 only the non-hyphenated
versions are supported. The affected commands:
@ -43,7 +43,7 @@ conveys how asdf works and provides similar functionality to `asdf global` and
Updates can no longer be performed this way. Use your OS package manager or
download the latest binary manually. Additionally, the `asdf update` command
present in versions 0.14.1 and older cannot upgrade to version 0.15.0 because
present in versions 0.15.0 and older cannot upgrade to version 0.15.0 because
the install process has changed. **You cannot upgrade to the latest Go
implementation using `asdf update`.**
@ -125,7 +125,7 @@ $ asdf cmd foo bat man # same as running `$ASDF_DATA_DIR/plugins/foo/lib/command
### Executables Shims Resolve to Must Runnable by `syscall.Exec`
The most obvious example of this breaking change are scripts that lack a proper
shebang line. asdf 0.14.1 and older were implemented in Bash, so as long it was
shebang line. asdf 0.15.0 and older were implemented in Bash, so as long it was
an executable that could be executed with Bash it would run. This mean that
scripts lacking a shebang could still be run by `asdf exec`. With asdf 0.15.x
implemented in Go we now invoke executables via Go's `syscall.Exec` function,

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

@ -31,7 +31,7 @@ run_shfmt_stylecheck() {
print.info "Checking .bash with shfmt"
shfmt --language-dialect bash --indent 2 "${shfmt_flag}" \
completions/*.bash \
cli/completions/*.bash \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
@ -55,7 +55,7 @@ run_shellcheck_linter() {
print.info "Checking .bash files with Shellcheck"
shellcheck --shell bash --external-sources \
completions/*.bash \
cli/completions/*.bash \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
@ -123,7 +123,7 @@ run_fish_linter() {
printf "%s\n" "[WARNING] fish_indent not found. Skipping .fish files."
else
print.info "Checking .fish files with fish_indent"
fish_indent "${flag}" ./**/*.fish
fish_indent "${flag}" ./cli/completions/asdf.fish
fi
}

View File

@ -1 +1 @@
0.14.1
0.15.0