mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-19 01:45:04 -07:00
Compare commits
6 Commits
cecff60c3f
...
22f0fd182b
Author | SHA1 | Date | |
---|---|---|---|
|
22f0fd182b | ||
|
753c0b7265 | ||
|
54d15e3fa6 | ||
|
a71ad59c04 | ||
|
d5f021482d | ||
|
518a0fa442 |
1
.github/workflows/semantic-pr.yml
vendored
1
.github/workflows/semantic-pr.yml
vendored
@ -28,3 +28,4 @@ jobs:
|
||||
website
|
||||
plugin
|
||||
completions
|
||||
deps
|
||||
|
93
CHANGELOG.md
93
CHANGELOG.md
@ -1,5 +1,98 @@
|
||||
# Changelog
|
||||
|
||||
## [0.16.0](https://github.com/asdf-vm/asdf/compare/v0.15.0...v0.16.0) (2024-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add Golang tests to GitHub test workflow ([3a9f539](https://github.com/asdf-vm/asdf/commit/3a9f539aa092fa7c043661232f8caa154e861c6f))
|
||||
* add linting for Golang to GitHub lint workflow ([f41ce90](https://github.com/asdf-vm/asdf/commit/f41ce90dc4410da7bb76c5ccf73147759716be07))
|
||||
* **golang-rewrite:** add boilerplate for cobra CLI commands ([d06d71f](https://github.com/asdf-vm/asdf/commit/d06d71f9f6b2fd6069c6fbf27bc7b13b8b0ec5c2))
|
||||
* **golang-rewrite:** add cobra library as dependency ([7d5281a](https://github.com/asdf-vm/asdf/commit/7d5281a8a9151d57113ea0dd5d2fea2b07f55228))
|
||||
* **golang-rewrite:** add config methods ([8ad3472](https://github.com/asdf-vm/asdf/commit/8ad3472abc64d8a07589a16096142b52aeae18af))
|
||||
* **golang-rewrite:** add placeholders for plugin subcommands ([b40beb6](https://github.com/asdf-vm/asdf/commit/b40beb6039b031d350bd1c621f34d90f23f72765))
|
||||
* **golang-rewrite:** BATS test fixes & `latest` command ([b23e5a3](https://github.com/asdf-vm/asdf/commit/b23e5a320fd231c4fa55baa3b32d90b55a6ff4f1))
|
||||
* **golang-rewrite:** build dev release binaries ([bc05110](https://github.com/asdf-vm/asdf/commit/bc0511015920acd8421bbccaead86e2badf0c2ae))
|
||||
* **golang-rewrite:** build golang asdf for BATS integration tests ([477e9d5](https://github.com/asdf-vm/asdf/commit/477e9d57293b8c99bcb184cfc72e064f4b68eda0))
|
||||
* **golang-rewrite:** compile asdf version into Go binaries ([6d708b2](https://github.com/asdf-vm/asdf/commit/6d708b280720d2144ae7976229fd5630eeb31eaf))
|
||||
* **golang-rewrite:** correct asdf-version workflow step to produce version as output ([572ed07](https://github.com/asdf-vm/asdf/commit/572ed07f2bdb31f04a7244d1d127594ef9922db0))
|
||||
* **golang-rewrite:** correct asdf-version workflow step to produce version as output ([19a0597](https://github.com/asdf-vm/asdf/commit/19a0597502ebecb0dfe2946fe19d9f9da3d57a18))
|
||||
* **golang-rewrite:** create `asdf current` command ([b33ab64](https://github.com/asdf-vm/asdf/commit/b33ab6463c7825a0d03f82f430cfad18a1e941c8))
|
||||
* **golang-rewrite:** create `asdf exec` command ([b966ca6](https://github.com/asdf-vm/asdf/commit/b966ca66271f1be81abee751dec929f97cadfab4))
|
||||
* **golang-rewrite:** create `asdf list` and `asdf list all` commands ([8db188a](https://github.com/asdf-vm/asdf/commit/8db188a702b1a64812fbb6e5832ec74ed47dfb34))
|
||||
* **golang-rewrite:** create `asdf uninstall` command ([3fd4a83](https://github.com/asdf-vm/asdf/commit/3fd4a839757a2646054f2d86f487731e0715eeaa))
|
||||
* **golang-rewrite:** create `asdf where` command ([09d06ff](https://github.com/asdf-vm/asdf/commit/09d06ff125107c19a24043e52cf60b378b8b4c3b))
|
||||
* **golang-rewrite:** create `asdf which` command ([d2afb85](https://github.com/asdf-vm/asdf/commit/d2afb85eb80bce85e79c9c0d91ad3103a7f985f0))
|
||||
* **golang-rewrite:** create `RunCallback` method for `Plugin` struct ([778ab34](https://github.com/asdf-vm/asdf/commit/778ab34a6f47ac913a0ebc5035d74bfbb3744ebe))
|
||||
* **golang-rewrite:** create `shims.FindExecutable` function for shim execution ([9f09f78](https://github.com/asdf-vm/asdf/commit/9f09f78ec06b28bd90d7cdd42762acc1e18011c7))
|
||||
* **golang-rewrite:** create `versions.InstallOneVersion` function ([6568891](https://github.com/asdf-vm/asdf/commit/65688915a5d6816b15acf7332d22920d10e8d99a))
|
||||
* **golang-rewrite:** create hooks ([771f184](https://github.com/asdf-vm/asdf/commit/771f18493fcc8684f02373b2f03750937016f51a))
|
||||
* **golang-rewrite:** create install command ([8313ebc](https://github.com/asdf-vm/asdf/commit/8313ebca2d2305b8e176286ae0a43b0359d78059))
|
||||
* **golang-rewrite:** create installs and installtest packages to avoid circular dependency ([be52d8f](https://github.com/asdf-vm/asdf/commit/be52d8f39c3aa253496c5469963cd0ecc995d19c))
|
||||
* **golang-rewrite:** create internal/resolve package ([c2e5ee6](https://github.com/asdf-vm/asdf/commit/c2e5ee652532f54aaed7e93796f7239a2a333446))
|
||||
* **golang-rewrite:** create Makefile ([9097696](https://github.com/asdf-vm/asdf/commit/9097696a4fa5ad7efeb383509ecce16125df3cbf))
|
||||
* **golang-rewrite:** create plugin list command ([ad0907a](https://github.com/asdf-vm/asdf/commit/ad0907a74df1edf42e7c72ecba96ea52e3de2bcf))
|
||||
* **golang-rewrite:** create plugin remove command ([2b02f51](https://github.com/asdf-vm/asdf/commit/2b02f51fa1acb2090713f6dfa70903281d28735a))
|
||||
* **golang-rewrite:** create plugin update command ([c480044](https://github.com/asdf-vm/asdf/commit/c4800443bd805afd1878891c56108366f3faba0c))
|
||||
* **golang-rewrite:** create pluginAddCommand function for plugin add command action ([26b91aa](https://github.com/asdf-vm/asdf/commit/26b91aa8288787e552dbc50a1c2234ad2264205c))
|
||||
* **golang-rewrite:** create pluginindex package ([202cdae](https://github.com/asdf-vm/asdf/commit/202cdae831b4909280e0f19ff77bbe4acaec36b4))
|
||||
* **golang-rewrite:** create plugins/git package to store plugin Git operations ([325cd33](https://github.com/asdf-vm/asdf/commit/325cd3334b3898cbd084ac3b3686458cc92b613e))
|
||||
* **golang-rewrite:** create settings and config structs for loading config ([07b5813](https://github.com/asdf-vm/asdf/commit/07b5813566431ce9f6245e884fe86dd13ad1c195))
|
||||
* **golang-rewrite:** create shimversions command ([822e14c](https://github.com/asdf-vm/asdf/commit/822e14c561ab1df74f091bb46bcb340ae9c2bda6))
|
||||
* **golang-rewrite:** create version 0.14 to 0.15 upgrade guide ([53cd454](https://github.com/asdf-vm/asdf/commit/53cd4544741cab2e58ca7ea8aa36c9c28890b0a1))
|
||||
* **golang-rewrite:** create versions.Latest function ([9f6a65f](https://github.com/asdf-vm/asdf/commit/9f6a65f5dda41d25a9e894ff6a8482810fd6dec8))
|
||||
* **golang-rewrite:** full version resolution ([bd7ab9a](https://github.com/asdf-vm/asdf/commit/bd7ab9ae0844c4c9e41760661a555bab13509752))
|
||||
* **golang-rewrite:** get all `install_command.bats` tests passing ([b6ec89f](https://github.com/asdf-vm/asdf/commit/b6ec89f95f6afedbbdb2daaf4c3d2f67f50f0cf1))
|
||||
* **golang-rewrite:** get remaining `shim_exec.bats` tests passing ([162cb8e](https://github.com/asdf-vm/asdf/commit/162cb8eceed53f58c20c547d29ca8068e411ce64))
|
||||
* **golang-rewrite:** implement `asdf help` command ([d94bace](https://github.com/asdf-vm/asdf/commit/d94baceb184b8a501a8eb1fd2cd33ca75bf962d9))
|
||||
* **golang-rewrite:** implement `asdf plugin list all` command ([e7df5ff](https://github.com/asdf-vm/asdf/commit/e7df5ff3253b6caba8ceef6b0754d17fcb765a9b))
|
||||
* **golang-rewrite:** implement `asdf plugin test` command ([369beeb](https://github.com/asdf-vm/asdf/commit/369beebab9c80197eb877660add870c0a6be5bda))
|
||||
* **golang-rewrite:** implement asdf env command ([26a3815](https://github.com/asdf-vm/asdf/commit/26a38159483588cd0143b58272f42c96e127d265))
|
||||
* **golang-rewrite:** implement asdf plugin extension commands ([ccc98ad](https://github.com/asdf-vm/asdf/commit/ccc98ad4e997b73dcc1e9d6839a17a539c5ec649))
|
||||
* **golang-rewrite:** info command ([447acd1](https://github.com/asdf-vm/asdf/commit/447acd13d1225e2e9ef80ae853c5da02fca034c3))
|
||||
* **golang-rewrite:** initialize golang module ([72c20b1](https://github.com/asdf-vm/asdf/commit/72c20b1b51d223dd6633f279258cb8bc54eb4661))
|
||||
* **golang-rewrite:** introduce `Version` struct, get some `shim_exec.bats` tests passing ([924eecf](https://github.com/asdf-vm/asdf/commit/924eecfa6af25f59162e3f35b913a1d0247bd34f))
|
||||
* **golang-rewrite:** make bats available for golang tests ([f5a5967](https://github.com/asdf-vm/asdf/commit/f5a59677df42f990529bd8a1668fcfea353ea4a0))
|
||||
* **golang-rewrite:** misc. plugin improvements ([3af0291](https://github.com/asdf-vm/asdf/commit/3af02913169abf9049933abc4d99406687d743c3))
|
||||
* **golang-rewrite:** misc. version improvements ([9ed4216](https://github.com/asdf-vm/asdf/commit/9ed4216525a2076b84e9e5fc6d454746a3b4d825))
|
||||
* **golang-rewrite:** misc. version improvements part 2 ([b9e79e6](https://github.com/asdf-vm/asdf/commit/b9e79e64564ad5a94c9d435458e1a57053744b8d))
|
||||
* **golang-rewrite:** more `asdf plugin remove` tests ([626bde0](https://github.com/asdf-vm/asdf/commit/626bde0a9785e400eaeb2fa72fb11fff6102b458))
|
||||
* **golang-rewrite:** more shim exec fixes ([f639f8a](https://github.com/asdf-vm/asdf/commit/f639f8a4d0a3fcc3cc175def3b3b2d1ebdac1ade))
|
||||
* **golang-rewrite:** more work to get `install_command.bats` test passing ([c0963a3](https://github.com/asdf-vm/asdf/commit/c0963a38a62e61586ef0dd34ea568d23345e3739))
|
||||
* **golang-rewrite:** move all Git code to git package ([cb49b64](https://github.com/asdf-vm/asdf/commit/cb49b64a5adb8944acff0c03e617df0a0f39453c))
|
||||
* **golang-rewrite:** offline Go tests ([f74efbf](https://github.com/asdf-vm/asdf/commit/f74efbf1bff5d7489f86f2f568eba2667d95645e))
|
||||
* **golang-rewrite:** PluginAdd function ([15e1f06](https://github.com/asdf-vm/asdf/commit/15e1f06f3751c9b72deea5cbad587140ba03c645))
|
||||
* **golang-rewrite:** re-organize Go code ([620c0d8](https://github.com/asdf-vm/asdf/commit/620c0d87e8bf1e1c99a5772c9103fa017e75f487))
|
||||
* **golang-rewrite:** refactor completion code and move all packages except `cmd` into `internal` ([518a0fa](https://github.com/asdf-vm/asdf/commit/518a0fa4422cff1625cb7b676f40c4bc0a42eed9))
|
||||
* **golang-rewrite:** rename module and move `main` pacakge to `cmd/asdf` ([5d5d04f](https://github.com/asdf-vm/asdf/commit/5d5d04fbb7a41c83ae5031182d7d671fae434cb5))
|
||||
* **golang-rewrite:** run bats integration tests in golang ([2fc8006](https://github.com/asdf-vm/asdf/commit/2fc80064902a3b467a82466add1db186a99f075a))
|
||||
* **golang-rewrite:** self-contained completion code ([c859384](https://github.com/asdf-vm/asdf/commit/c8593842eeb2a3eae74af7747afc62fa406a5b54))
|
||||
* **golang-rewrite:** set variables for bats integration tests ([2951011](https://github.com/asdf-vm/asdf/commit/2951011090a2a8ac3f42d54198a2447213171c38))
|
||||
* **golang-rewrite:** setup Golang release GitHub workflow ([c5092c6](https://github.com/asdf-vm/asdf/commit/c5092c6dbfce3614f3de2db08afaa6fcb8b7792e))
|
||||
* **golang-rewrite:** setup goreleaser ([3f9744d](https://github.com/asdf-vm/asdf/commit/3f9744df0fd8b23684ef2c705642232c5d2151af))
|
||||
* **golang-rewrite:** shim generation 2 ([985c181](https://github.com/asdf-vm/asdf/commit/985c181118b39bb555a2bd2a1cdbf111a25bd512))
|
||||
* **golang-rewrite:** shim generation part 1 ([18e21c9](https://github.com/asdf-vm/asdf/commit/18e21c90284be35fa01e957b49336ffac515e19b))
|
||||
* **golang-rewrite:** update upgrade guide ([0058988](https://github.com/asdf-vm/asdf/commit/005898800bded840fa7dd9b62a0c60a93c124c8c))
|
||||
* **golang-rewrite:** use plugin index ([8394e85](https://github.com/asdf-vm/asdf/commit/8394e858fee419ed38833fa953b122fe04754830))
|
||||
* **golang-rewrite:** use version type when generating shims ([5266ba5](https://github.com/asdf-vm/asdf/commit/5266ba581ddf5f96de2d20391e340bb4f7c123c4))
|
||||
* **golang-rewrite:** version file parsing ([3155dc3](https://github.com/asdf-vm/asdf/commit/3155dc374e9cbea6d2d792fef08914124320a292))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **golang-rewrite:** `asdf exec` and `asdf env` command fixes ([7dfa8b4](https://github.com/asdf-vm/asdf/commit/7dfa8b40ae5e557b90fb7917bc86a569cf2bd0a6))
|
||||
* **golang-rewrite:** add missing goreleaser argument ([5a24864](https://github.com/asdf-vm/asdf/commit/5a2486463238e2473aab739520793011267be19f))
|
||||
* **golang-rewrite:** allow directories returned by list-bin-paths to be absent from the file system ([80ac9bb](https://github.com/asdf-vm/asdf/commit/80ac9bb51c684c04829328c28a06aa1f1f67a8f2))
|
||||
* **golang-rewrite:** attempt to fix goreleaser GitHub workflow ([1b3c426](https://github.com/asdf-vm/asdf/commit/1b3c42699a30b6bcc7295d3f433dad9cd520f130))
|
||||
* **golang-rewrite:** comment out all BATS tests ([163d6b4](https://github.com/asdf-vm/asdf/commit/163d6b4b462954a2f52b6a1b9e09faa806292260))
|
||||
* **golang-rewrite:** correct go build command in lint workflow ([87d3c06](https://github.com/asdf-vm/asdf/commit/87d3c06cf5dc859dab4d1af3dec290ed49651b67))
|
||||
* **golang-rewrite:** fix dependencies script on linux ([3f17a80](https://github.com/asdf-vm/asdf/commit/3f17a80fbe34ee68a3d5580798374caf1a7bc4ae))
|
||||
* **golang-rewrite:** set dependencies between release-build jobs ([6b45a5e](https://github.com/asdf-vm/asdf/commit/6b45a5e5f74f60a22fd20b331163f5e5d6a3881c))
|
||||
* **golang-rewrite:** try to fix goreleaser ([2a31caf](https://github.com/asdf-vm/asdf/commit/2a31cafd38128be86696c0a46e0223a95b8129fe))
|
||||
* **golang-rewrite:** try to get goreleaser action to generate snapshot builds ([7439ea9](https://github.com/asdf-vm/asdf/commit/7439ea916829f7c3f1f2932fa17b3d2848c2dbe7))
|
||||
* **golang-rewrite:** update detect-changes logic for Golang tests ([88af4ee](https://github.com/asdf-vm/asdf/commit/88af4eea00c395407a4b904e80e307ad864a6535))
|
||||
* update GitHub workflows to work private asdf Go fork ([3e11bd4](https://github.com/asdf-vm/asdf/commit/3e11bd4b330555a882c65d30e4c702888b185879))
|
||||
|
||||
## [0.15.0](https://github.com/asdf-vm/asdf/compare/v0.14.1...v0.15.0) (2024-12-18)
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Main entrypoint for the CLI app
|
||||
package main
|
||||
|
||||
import "github.com/asdf-vm/asdf/cli"
|
||||
import "github.com/asdf-vm/asdf/internal/cli"
|
||||
|
||||
// Replaced with the real version during a typical build
|
||||
var version = "v-dev"
|
||||
|
6
go.mod
6
go.mod
@ -10,7 +10,7 @@ require (
|
||||
github.com/sethvargo/go-envconfig v1.0.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/urfave/cli/v2 v2.27.1
|
||||
golang.org/x/sys v0.15.0
|
||||
golang.org/x/sys v0.28.0
|
||||
gopkg.in/ini.v1 v1.67.0
|
||||
)
|
||||
|
||||
@ -35,9 +35,9 @@ require (
|
||||
github.com/skeema/knownhosts v1.2.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
golang.org/x/crypto v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.31.0 // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/tools v0.13.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
|
20
go.sum
20
go.sum
@ -90,8 +90,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
|
||||
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
||||
@ -103,8 +103,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -123,15 +123,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
|
||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@ -139,8 +139,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
|
@ -2,7 +2,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -14,6 +13,7 @@ import (
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/completions"
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/exec"
|
||||
"github.com/asdf-vm/asdf/internal/execenv"
|
||||
@ -52,7 +52,7 @@ func Execute(version string) {
|
||||
|
||||
app := &cli.App{
|
||||
Name: "asdf",
|
||||
Version: "0.1.0",
|
||||
Version: version,
|
||||
// Not really sure what I should put here, but all the new Golang code will
|
||||
// likely be written by me.
|
||||
Copyright: "(c) 2024 Trevor Brown",
|
||||
@ -315,45 +315,18 @@ 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)
|
||||
file, ok := completions.Get(shell)
|
||||
if !ok {
|
||||
l.Printf(`No completions available for shell with name %q
|
||||
Completions are available for: %v`, shell, strings.Join(completions.Names(), ", "))
|
||||
return errors.New("bad shell name")
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
io.Copy(os.Stdout, file)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// This function is a whole mess and needs to be refactored
|
40
internal/completions/completions.go
Normal file
40
internal/completions/completions.go
Normal file
@ -0,0 +1,40 @@
|
||||
// Package completions handles shell completion files.
|
||||
//
|
||||
// To add completion support for a shell, simply add a file named
|
||||
// "asdf.<shell>" to this directory, replacing "<shell>" with the name
|
||||
// of the shell.
|
||||
package completions
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed asdf.*
|
||||
var completions embed.FS
|
||||
|
||||
// Get returns a file containing completion code for the given shell if it is
|
||||
// found.
|
||||
func Get(name string) (fs.File, bool) {
|
||||
file, err := completions.Open("asdf." + name)
|
||||
if err != nil {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return nil, false
|
||||
}
|
||||
panic(err) // This should never happen.
|
||||
}
|
||||
return file, true
|
||||
}
|
||||
|
||||
// Names returns a slice of shell names that completion is available for.
|
||||
func Names() []string {
|
||||
files, _ := fs.Glob(completions, "asdf.*")
|
||||
for i, file := range files {
|
||||
files[i] = strings.TrimPrefix(file, "asdf.")
|
||||
}
|
||||
slices.Sort(files)
|
||||
return files
|
||||
}
|
30
internal/completions/completions_test.go
Normal file
30
internal/completions/completions_test.go
Normal file
@ -0,0 +1,30 @@
|
||||
package completions
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
t.Run("returns file when completion file found with matching name", func(t *testing.T) {
|
||||
file, found := Get("bash")
|
||||
|
||||
info, err := file.Stat()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "asdf.bash", info.Name())
|
||||
|
||||
assert.True(t, found)
|
||||
})
|
||||
|
||||
t.Run("returns false when completion file not found", func(t *testing.T) {
|
||||
_, found := Get("non-existent")
|
||||
assert.False(t, found)
|
||||
})
|
||||
}
|
||||
|
||||
func TestNames(t *testing.T) {
|
||||
t.Run("returns slice of shell names for which completion is available", func(t *testing.T) {
|
||||
assert.Equal(t, []string{"bash", "elvish", "fish", "nushell", "zsh"}, Names())
|
||||
})
|
||||
}
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/installtest"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/toolversions"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/git"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/data"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"github.com/asdf-vm/asdf/internal/installs"
|
||||
"github.com/asdf-vm/asdf/internal/installtest"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/toolversions"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/asdf-vm/asdf/internal/config"
|
||||
"github.com/asdf-vm/asdf/internal/plugins"
|
||||
"github.com/asdf-vm/asdf/internal/repotest"
|
||||
"github.com/asdf-vm/asdf/internal/toolversions"
|
||||
"github.com/asdf-vm/asdf/repotest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -31,7 +31,7 @@ run_shfmt_stylecheck() {
|
||||
|
||||
print.info "Checking .bash with shfmt"
|
||||
shfmt --language-dialect bash --indent 2 "${shfmt_flag}" \
|
||||
cli/completions/*.bash \
|
||||
internal/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 \
|
||||
internal/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}" ./internal/completions/asdf.fish
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
0.15.0
|
||||
0.16.0
|
||||
|
Loading…
Reference in New Issue
Block a user