Compare commits

..

163 Commits

Author SHA1 Message Date
Trevor Brown
4ef66a2275 Merge pull request #96 from asdf-vm/tb/version-improvements-2
feat(golang-rewrite): misc. version improvements part 2
2024-12-18 10:22:06 -05:00
Trevor Brown
fdd342185d Merge pull request #95 from asdf-vm/tb/version-improvements
feat(golang-rewrite): misc. version improvements
2024-12-18 10:22:06 -05:00
Trevor Brown
f2ced32566 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 10:22:06 -05:00
Trevor Brown
33f50650e1 Merge pull request #94 from asdf-vm/tb/plugin-improvements
feat(golang-rewrite): misc. plugin improvements
2024-12-18 10:22:06 -05:00
Trevor Brown
5f162147a4 feat(golang-rewrite): misc. version improvements
* Update `pluginListCommand` to print tools and versions to STDOUT
* Improve output of `asdf current` command
2024-12-18 10:22:06 -05:00
Trevor Brown
f027456316 Merge pull request #93 from asdf-vm/tb/go-upgrade
chore(golang-rewrite): upgrade to Go 1.23.4
2024-12-18 10:22:06 -05:00
Trevor Brown
81f732bd4b 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 10:22:06 -05:00
Trevor Brown
bd3e35e022 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 10:22:06 -05:00
Trevor Brown
36d7240b64 chore(golang-rewrite): upgrade to Go 1.23.4
* Fix `release-build` workflow
* Upgrade to Go 1.23.4
2024-12-18 10:22:06 -05:00
Trevor Brown
0048dbfa95 Merge pull request #91 from asdf-vm/tb/plugin-test-command
feat(golang-rewrite): implement `asdf plugin test` command
2024-12-18 10:22:06 -05:00
DeedleFake
27f44a2dc9 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 10:22:06 -05:00
Trevor Brown
34e1e85bbb Merge pull request #90 from asdf-vm/tb/plugin-extension-commands
feat(golang-rewrite): implement asdf plugin extension commands
2024-12-18 10:22:06 -05:00
Your Name
a7ae6303cc feat(golang-rewrite): implement asdf plugin test command
* Enable `plugin_test_command.bats` tests
* Implement `asdf plugin test` command
2024-12-18 10:22:06 -05:00
Trevor Brown
5728e3709c Merge pull request #89 from asdf-vm/tb/plugin-list-all-tests
feat(golang-rewrite): implement `asdf plugin list all` command
2024-12-18 10:22:06 -05:00
Your Name
6501674809 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 10:22:06 -05:00
Trevor Brown
8d5df1c0a4 Merge pull request #88 from asdf-vm/tb/install-command-tests
feat(golang-rewrite): get all `install_command.bats` tests passing
2024-12-18 10:22:06 -05:00
Trevor Brown
ec22c68b96 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 10:22:06 -05:00
Trevor Brown
0c390c46a8 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 10:22:05 -05:00
Trevor Brown
b831807ec9 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 10:21:42 -05:00
Trevor Brown
3aa5a0da49 Merge pull request #86 from asdf-vm/tb/more-shim-exec-fixes
feat(golang-rewrite): more shim exec fixes
2024-12-18 10:21:42 -05:00
Trevor Brown
8736de47e7 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 10:21:42 -05:00
Trevor Brown
9192e51708 Merge pull request #83 from asdf-vm/tb/shim-exec-fixes
fix(golang-rewrite): `asdf exec` and `asdf env` command fixes
2024-12-18 10:21:42 -05:00
Trevor Brown
1ea658d629 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 10:21:42 -05:00
Trevor Brown
ce0f371d24 Merge pull request #82 from asdf-vm/tb/shim-exec-env
feat(golang-rewrite): implement `asdf env` command
2024-12-18 10:21:42 -05:00
Trevor Brown
ee8f88daaa 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 10:21:42 -05:00
Trevor Brown
ddb0dd4bca 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 10:21:42 -05:00
Trevor Brown
4d87349964 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 10:21:42 -05:00
Trevor Brown
517102b8ff 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 10:21:42 -05:00
Trevor Brown
64f70de694 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 10:21:42 -05:00
Trevor Brown
96124c416f 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 10:21:42 -05:00
Trevor Brown
5149f03925 feat(golang-rewrite): correct asdf-version workflow step to produce version as output 2024-12-18 10:21:42 -05:00
Trevor Brown
c18b2de10f Merge pull request #78 from asdf-vm/tb/asdf-version-info
feat(golang-rewrite): compile asdf version into Go binaries
2024-12-18 10:21:42 -05:00
Trevor Brown
d80b409b65 feat(golang-rewrite): correct asdf-version workflow step to produce version as output 2024-12-18 10:21:42 -05:00
Trevor Brown
9a7c12fb63 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 10:21:42 -05:00
Trevor Brown
c80b0ff380 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 10:21:42 -05:00
Trevor Brown
7d46d4bf50 Merge pull request #76 from asdf-vm/tb/shim-versions-command
feat(golang-rewrite): create shimversions command
2024-12-18 10:21:42 -05:00
Trevor Brown
424eed413b 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 10:21:42 -05:00
Trevor Brown
3d4d4366ab 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 10:21:42 -05:00
Trevor Brown
a5ecc6a557 feat(golang-rewrite): create shimversions command
* Enable `shim_versions_command.bats` tests
* Create `asdf shimversions` command
2024-12-18 10:21:42 -05:00
Trevor Brown
774723a52f Merge pull request #74 from asdf-vm/tb/remove-command-bats
feat(golang-rewrite): more `asdf plugin remove` tests
2024-12-18 10:21:42 -05:00
Trevor Brown
7025de2a24 feat(golang-rewrite): create version 0.14 to 0.15 upgrade guide 2024-12-18 10:21:42 -05:00
Trevor Brown
0d18fa1694 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 10:21:42 -05:00
Trevor Brown
e75659ca67 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 10:21:42 -05:00
Trevor Brown
00c9178b77 Merge pull request #72 from asdf-vm/tb/asdf-uninstall-command
feat(golang-rewrite): create `asdf uninstall` command
2024-12-18 10:21:42 -05:00
Trevor Brown
3be463524e 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 10:21:42 -05:00
Trevor Brown
241949bc19 Merge pull request #71 from asdf-vm/tb/asdf-where-command
feat(golang-rewrite): create `asdf where` command
2024-12-18 10:21:42 -05:00
Trevor Brown
deef401fd3 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 10:21:42 -05:00
Trevor Brown
ed0bb953b7 Merge pull request #70 from asdf-vm/tb/asdf-help-command
feat(golang-rewrite): implement `asdf help` command
2024-12-18 10:21:42 -05:00
Trevor Brown
0a58b32142 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 10:21:42 -05:00
Trevor Brown
00e56bf47d Merge pull request #68 from asdf-vm/tb/which-command
feat(golang-rewrite): create `asdf which` command
2024-12-18 10:21:42 -05:00
Trevor Brown
a33bbd8531 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 10:21:42 -05:00
Trevor Brown
f69d16c2fd 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 10:21:42 -05:00
Trevor Brown
1ab256335f Merge pull request #69 from asdf-vm/tb/build-release-binaries
feat(golang-rewrite): build dev release binaries
2024-12-18 10:21:41 -05:00
Trevor Brown
87809c176f Merge pull request #67 from asdf-vm/tb/current-command
feat(golang-rewrite): create `asdf current` command
2024-12-18 10:21:41 -05:00
Trevor Brown
c1c0d52891 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 10:21:41 -05:00
Trevor Brown
2d3564534a Merge pull request #66 from asdf-vm/tb/shim-exec-2
feat(golang-rewrite): create `asdf exec` command
2024-12-18 10:21:41 -05:00
Trevor Brown
c86e84fffb 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 10:21:41 -05:00
Trevor Brown
a889d8369d Merge pull request #65 from asdf-vm/tb/shim-exec-1
feat(golang-rewrite): create `shims.FindExecutable` function for shim execution
2024-12-18 10:21:41 -05:00
Trevor Brown
e10dae7dc6 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 10:21:41 -05:00
Trevor Brown
85c5e74741 Merge pull request #64 from asdf-vm/tb/shim-generation-4
feat(golang-rewrite): use version type when generating shims
2024-12-18 10:21:41 -05:00
Trevor Brown
2817b51339 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 10:21:41 -05:00
Trevor Brown
ec156d66b9 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 10:21:41 -05:00
Trevor Brown
54552f91bf 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 10:21:41 -05:00
Trevor Brown
a5609cf2f3 Merge pull request #62 from asdf-vm/tb/reorganize-go-code
feat(golang-rewrite): re-organize Go code
2024-12-18 10:21:41 -05:00
Trevor Brown
f1cec5574a 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 10:21:41 -05:00
Trevor Brown
43cd285727 Merge pull request #61 from asdf-vm/tb/shim-generation-2
feat(golang-rewrite): shim generation 2
2024-12-18 10:21:41 -05:00
Trevor Brown
ec1fe94311 feat(golang-rewrite): re-organize Go code
* move most Go packages to internal directory
* update import paths
2024-12-18 10:21:41 -05:00
Trevor Brown
1cacaa0a70 Merge pull request #60 from asdf-vm/tb/shim-generation
feat(golang-rewrite): shim generation part 1
2024-12-18 10:21:41 -05:00
Trevor Brown
030b294234 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 10:21:41 -05:00
Trevor Brown
5c5059535c 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 10:21:41 -05:00
Trevor Brown
48465d4884 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 10:21:41 -05:00
Trevor Brown
3f12692774 Merge pull request #58 from asdf-vm/tb/bats-test-fixes
feat(golang-rewrite): BATS test fixes & `latest` command
2024-12-18 10:21:41 -05:00
Trevor Brown
fd4401494d 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 10:21:41 -05:00
Trevor Brown
bd9d80f49e Merge pull request #57 from asdf-vm/tb/install-command
feat(golang-rewrite): create install command
2024-12-18 10:21:41 -05:00
Trevor Brown
040df16084 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 10:21:41 -05:00
Trevor Brown
63103a0b6a Merge pull request #56 from asdf-vm/tb/latest-version
feat(golang-rewrite): create versions.Latest function
2024-12-18 10:21:41 -05:00
Trevor Brown
2de83c2ae1 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 10:21:41 -05:00
Trevor Brown
440ef9050b Merge pull request #54 from asdf-vm/tb/asdf-install-cmd
feat(golang-rewrite): create `versions.InstallOneVersion` function
2024-12-18 10:21:41 -05:00
Trevor Brown
dc08dc1a00 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 10:21:41 -05:00
Trevor Brown
99df51fca6 Merge pull request #53 from asdf-vm/tb/full-version-resolution
feat(golang-rewrite): full version resolution
2024-12-18 10:21:41 -05:00
Trevor Brown
beaf038dba 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 10:21:41 -05:00
Trevor Brown
01ec98eef4 Merge pull request #52 from asdf-vm/tb/version-resolution
feat(golang-rewrite): create internal/resolve package
2024-12-18 10:21:41 -05:00
Trevor Brown
bd3d83092c 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 10:21:41 -05:00
Trevor Brown
356720f610 Merge pull request #51 from asdf-vm/tb/offline-tests
feat(golang-rewrite): offline Go tests
2024-12-18 10:21:41 -05:00
Trevor Brown
30cf61a278 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 10:21:41 -05:00
Trevor Brown
42b2f0294b Merge pull request #50 from asdf-vm/tb/version-file-parsing
feat(golang-rewrite): version file parsing
2024-12-18 10:21:41 -05:00
Trevor Brown
7533fbb5c8 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 10:21:41 -05:00
Trevor Brown
dc9521be61 Merge pull request #49 from asdf-vm/tb/info-command
feat(golang-rewrite): info command
2024-12-18 10:21:41 -05:00
Trevor Brown
a0cd0319cb feat(golang-rewrite): version file parsing
* Create toolversions package
* Address linter errors for toolversions package
* Write tests
2024-12-18 10:21:41 -05:00
Trevor Brown
259959c6e7 Merge pull request #48 from asdf-vm/tb/plugin-callback-invocation
feat(golang-rewrite): create `RunCallback` method for `Plugin` struct
2024-12-18 10:21:41 -05:00
Trevor Brown
f657055832 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 10:21:41 -05:00
Trevor Brown
2531de184a Merge pull request #45 from asdf-vm/tb/command-exec
feat(golang-rewrite): create hooks
2024-12-18 10:21:41 -05:00
Trevor Brown
f1e7c05ae3 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 10:21:41 -05:00
Trevor Brown
44e8257dcf Merge pull request #44 from asdf-vm/tb/use-plugin-index
feat(golang-rewrite): use plugin index
2024-12-18 10:21:41 -05:00
Trevor Brown
b1a47fe2bf 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 10:21:41 -05:00
Trevor Brown
a5bc137ab3 Merge pull request #42 from asdf-vm/tb/git-code-refactor
feat(golang-rewrite): move all Git code to git package
2024-12-18 10:21:41 -05:00
Trevor Brown
1785ed8d20 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 10:21:41 -05:00
Trevor Brown
031419b549 Merge pull request #40 from asdf-vm/tb/plugin-repository
feat(golang-rewrite): create pluginindex package
2024-12-18 10:21:41 -05:00
Trevor Brown
8cb2918169 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 10:21:41 -05:00
Trevor Brown
642e63a931 Merge pull request #36 from asdf-vm/tb/plugin-update-cmd
feat(golang-rewrite): create plugin update command
2024-12-18 10:21:41 -05:00
Trevor Brown
da5c91d30a 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 10:21:41 -05:00
Trevor Brown
81199ded61 Merge pull request #38 from asdf-vm/tb/setup-gofumpt
chore(golang-rewrite): setup gofumpt
2024-12-18 10:21:41 -05:00
Trevor Brown
4c0d5893c0 feat(golang-rewrite): create plugin update command 2024-12-18 10:21:41 -05:00
Trevor Brown
f5cfe36b18 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 10:21:41 -05:00
Trevor Brown
b8d13190ed 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 10:21:41 -05:00
Trevor Brown
7179459a4d feat(golang-rewrite): create plugins/git package to store plugin Git operations 2024-12-18 10:21:41 -05:00
Trevor Brown
0d15e5644d Merge pull request #33 from asdf-vm/tb/default-config-refactor
chore(golang-rewrite): default settings refactor
2024-12-18 10:21:27 -05:00
Trevor Brown
52a7c7a432 chore(golang-rewrite): rename files for plugins and cmd packages 2024-12-18 10:21:27 -05:00
Trevor Brown
826de00cbf chore(golang-rewrite): default settings refactor 2024-12-18 10:21:27 -05:00
Trevor Brown
b8eda79837 Merge pull request #32 from asdf-vm/tb/workflow-improvements
chore(golang-rewrite): Github workflow improvements
2024-12-18 10:21:27 -05:00
Trevor Brown
90fc14191c Merge pull request #31 from asdf-vm/tb/add-makefile
feat(golang-rewrite): create Makefile
2024-12-18 10:21:27 -05:00
Trevor Brown
cfd7e0d046 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 10:21:27 -05:00
Trevor Brown
dab4657784 feat(golang-rewrite): create Makefile
* Address Go linter warnings
* Fix Github workflow
2024-12-18 10:21:25 -05:00
Trevor Brown
d79027a8f6 Merge pull request #30 from asdf-vm/tb/plugin-remove-command
feat(golang-rewrite): create plugin remove command
2024-12-18 10:21:11 -05:00
Trevor Brown
974b11b0fe Merge pull request #29 from asdf-vm/tb/plugin-list-command
feat(golang-rewrite): create plugin list command
2024-12-18 10:21:11 -05:00
Trevor Brown
b1f1414e4d 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 10:21:11 -05:00
Trevor Brown
89e9be5b04 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 10:21:11 -05:00
Trevor Brown
6d01b38abc 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 10:21:11 -05:00
Trevor Brown
8f6e321d4a Merge pull request #26 from asdf-vm/tb/plugin-add-command
feat(golang-rewrite): PluginAdd function
2024-12-18 10:21:11 -05:00
Trevor Brown
db5db87322 feat(golang-rewrite): create pluginAddCommand function for plugin add command action 2024-12-18 10:21:11 -05:00
Trevor Brown
147ce31160 Merge pull request #25 from asdf-vm/tb/plugin-command-placeholders
feat(golang-rewrite): add placeholders for plugin subcommands
2024-12-18 10:21:11 -05:00
Trevor Brown
da44ce242f 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 10:21:11 -05:00
Trevor Brown
be3fb7cb51 Merge pull request #24 from asdf-vm/tb/config-api
feat(golang-rewrite): add config methods
2024-12-18 10:21:11 -05:00
Trevor Brown
2e4e4cd879 feat(golang-rewrite): add placeholders for plugin subcommands
* Switch from cobra to urfave/cli
* Create placeholder plugin command structs
2024-12-18 10:21:11 -05:00
Trevor Brown
1c4757f0ed 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 10:21:11 -05:00
Trevor Brown
d33701f7a6 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 10:21:11 -05:00
Trevor Brown
66c7abc0d0 Merge pull request #23 from asdf-vm/tb/setup-config
feat(golang-rewrite): create settings and config structs for loading config
2024-12-18 10:21:11 -05:00
dependabot[bot]
c9a9e575e7 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 10:21:11 -05:00
Trevor Brown
abd12bb09d Merge pull request #22 from asdf-vm/tb/workflow-fix
fix(golang-rewrite): update detect-changes logic for Golang tests
2024-12-18 10:21:11 -05:00
Trevor Brown
7a72ce60ac 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 10:21:11 -05:00
Trevor Brown
7217e58270 Merge pull request #21 from asdf-vm/tb/cli-arg-parsing
feat(golang-rewrite): setup Cobra for command line interface
2024-12-18 10:21:11 -05:00
Trevor Brown
edd4a1015b fix(golang-rewrite): update detect-changes logic for Golang tests 2024-12-18 10:21:11 -05:00
Trevor Brown
f787db7a90 Merge pull request #20 from asdf-vm/tb/bats-tests-golang
feat(golang-rewrite): run BATS integration tests for Golang implementation
2024-12-18 10:21:11 -05:00
Trevor Brown
229ca564f7 feat(golang-rewrite): add boilerplate for cobra CLI commands 2024-12-18 10:21:11 -05:00
Trevor Brown
6bc837cc3e 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 10:21:11 -05:00
Trevor Brown
b4710039e7 fix(golang-rewrite): comment out all BATS tests 2024-12-18 10:21:11 -05:00
Trevor Brown
a08b71219d feat(golang-rewrite): add cobra library as dependency 2024-12-18 10:21:11 -05:00
Trevor Brown
b8db3fbb69 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 10:21:11 -05:00
Trevor Brown
1ddb154418 fix(golang-rewrite): attempt to fix goreleaser GitHub workflow 2024-12-18 10:21:11 -05:00
Trevor Brown
9465bc221e fix(golang-rewrite): fix dependencies script on linux 2024-12-18 10:21:11 -05:00
Trevor Brown
1210705838 Merge pull request #14 from asdf-vm/tb/attempt-to-fix-goreleaser
fix(golang-rewrite): try to fix goreleaser
2024-12-18 10:21:11 -05:00
Trevor Brown
4e3fc58ca4 fix(golang-rewrite): try to get goreleaser action to generate snapshot builds 2024-12-18 10:21:11 -05:00
Trevor Brown
fa2404559b feat(golang-rewrite): make bats available for golang tests 2024-12-18 10:21:11 -05:00
Trevor Brown
5604c2f7de Merge pull request #13 from asdf-vm/tb/workflow-jobs-fix
fix(golang-rewrite): set dependencies between release-build jobs
2024-12-18 10:21:11 -05:00
Trevor Brown
80b52c28a1 fix(golang-rewrite): try to fix goreleaser 2024-12-18 10:21:11 -05:00
Trevor Brown
4d5108c905 feat(golang-rewrite): set variables for bats integration tests 2024-12-18 10:21:11 -05:00
Trevor Brown
ffa80b4793 Merge pull request #12 from asdf-vm/tb/golang-build-fix
fix(golang-rewrite): add missing goreleaser argument
2024-12-18 10:21:11 -05:00
Trevor Brown
d9ce6ca238 fix(golang-rewrite): set dependencies between release-build jobs 2024-12-18 10:21:11 -05:00
Trevor Brown
ff82d9787c feat(golang-rewrite): build golang asdf for BATS integration tests 2024-12-18 10:21:11 -05:00
Trevor Brown
fb8fbcfa1c Merge pull request #11 from asdf-vm/tb/golang-builds
feat(golang-rewrite): setup Golang CI builds
2024-12-18 10:21:11 -05:00
Trevor Brown
b3faf4aca0 fix(golang-rewrite): add missing goreleaser argument 2024-12-18 10:21:11 -05:00
Trevor Brown
3cc6d8d3bb feat(golang-rewrite): run bats integration tests in golang 2024-12-18 10:21:11 -05:00
Trevor Brown
81e3010880 Merge pull request #8 from asdf-vm/tb/github-workflow-setup
feat: Add Golang checks to GitHub workflows
2024-12-18 10:21:11 -05:00
Trevor Brown
abf03357bc fix(golang-rewrite): correct go build command in lint workflow 2024-12-18 10:21:11 -05:00
Trevor Brown
58a645c63a Merge pull request #5 from asdf-vm/tb/initialize-go-project
feat(golang-rewrite): initialize golang module
2024-12-18 10:21:11 -05:00
Trevor Brown
3c876d25cd feat: add Golang tests to GitHub test workflow 2024-12-18 10:21:11 -05:00
Trevor Brown
1a36afb7bb feat(golang-rewrite): setup Golang release GitHub workflow 2024-12-18 10:21:11 -05:00
Trevor Brown
2257491f25 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 10:21:11 -05:00
Trevor Brown
3d9fc41fbc feat(golang-rewrite): initialize golang module 2024-12-18 10:21:11 -05:00
Trevor Brown
d8afc037c7 feat: add linting for Golang to GitHub lint workflow 2024-12-18 10:21:11 -05:00
Trevor Brown
6f5b0818c8 feat(golang-rewrite): setup goreleaser 2024-12-18 10:21:11 -05:00
dependabot[bot]
6aaf7c3b2f 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 10:21:11 -05:00
Trevor Brown
71be7f83cf fix: update GitHub workflows to work private asdf Go fork 2024-12-18 10:21:11 -05:00
16 changed files with 27 additions and 529 deletions

View File

@ -1,29 +1,5 @@
# 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,6 +1,4 @@
# 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.15.0
0.14.1
```
<!-- x-release-please-end -->

50
asdf.nu
View File

@ -74,30 +74,6 @@ 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"
@ -169,15 +145,15 @@ module asdf {
# 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
name?: string # Name of the package
version?: string # 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
version: string # Version of the package
]
# Display current version
@ -193,31 +169,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@"complete asdf plugin versions installed" # Version of installed package
version?: string # 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
version?: string # 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
version?: string # 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
version?: string # 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
name: string # Name of the package
version?: string # Filter latest stable version from this version
]
# Show latest stable version for all installed packages
@ -226,13 +202,13 @@ module asdf {
# 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
version?: string # 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
version?: string="" # Filter the version
] {
^asdf list all $name $version | lines | parse "{version}" | str trim
}
@ -240,7 +216,7 @@ module asdf {
# 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
version?: string # Version of the plugin
]
# Execute a command shim for the current version
@ -261,7 +237,7 @@ module asdf {
# 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
version?: string # Version of the package
]
# List the plugins and versions that provide a command

View File

@ -2,7 +2,6 @@
package cli
import (
_ "embed"
"errors"
"fmt"
"io"
@ -72,13 +71,6 @@ 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{
@ -315,47 +307,6 @@ 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()

View File

@ -1,148 +0,0 @@
# 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
}
}
}

View File

@ -1,250 +0,0 @@
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,5 +1,4 @@
#compdef asdf
compdef _asdf asdf
#description tool to manage versions of multiple runtimes
local curcontext="$curcontext" state state_descr line subcmd
@ -91,7 +90,6 @@ _asdf__installed_versions_of_plus_system() {
compadd -a versions
}
_asdf() {
local -i IntermediateCount=0
@ -119,8 +117,6 @@ _asdf__dash_commands() {
subcmd="${subcmd}-${words[2+IntermediateCount]}"
fi
}
case "$subcmd" in
(plugin|shim|list)
_asdf__dash_commands
@ -224,4 +220,3 @@ 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.15.0
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
```

View File

@ -1,6 +1,6 @@
# Upgrading From Version 0.15.x to 0.16.0
# Upgrading From Version 0.14.x to 0.15.0
asdf versions 0.15.0 and older were written in Bash and distributed as a set of
asdf versions 0.14.1 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.15.0 and earlier supported by hyphenated and non-hyphenated
asdf version 0.14.1 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.15.0 and older cannot upgrade to version 0.15.0 because
present in versions 0.14.1 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.15.0 and older were implemented in Bash, so as long it was
shebang line. asdf 0.14.1 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.15.0
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
```
<!-- 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.15.0
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
```
<!-- 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}" \
cli/completions/*.bash \
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 \
cli/completions/*.bash \
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}" ./cli/completions/asdf.fish
fish_indent "${flag}" ./**/*.fish
fi
}

View File

@ -1 +1 @@
0.15.0
0.14.1