File tree 3 files changed +60
-46
lines changed
3 files changed +60
-46
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ _ "embed"
5
6
"os"
6
7
"runtime"
7
8
"sort"
@@ -12,6 +13,11 @@ import (
12
13
"github.com/willabides/bindown/v3"
13
14
)
14
15
16
+ //go:generate sh -c "go tool dist list > go_dist_list.txt"
17
+
18
+ //go:embed go_dist_list.txt
19
+ var goDists string
20
+
15
21
func findConfigFileForCompletion (args []string ) string {
16
22
for i , arg := range args {
17
23
if len (args ) == i + 1 {
@@ -184,50 +190,5 @@ func systemCompleter(ctx context.Context) complete.PredictFunc {
184
190
}
185
191
186
192
var allSystemsCompleter = complete .PredictFunc (func (a complete.Args ) []string {
187
- return strings .Split (goDists , "\n " )
193
+ return append ([] string { "current" }, strings .Split (goDists , "\n " ) ... )
188
194
})
189
-
190
- // from `go tool dist list`
191
- const goDists = `aix/ppc64
192
- android/386
193
- android/amd64
194
- android/arm
195
- android/arm64
196
- darwin/386
197
- darwin/amd64
198
- darwin/arm
199
- darwin/arm64
200
- dragonfly/amd64
201
- freebsd/386
202
- freebsd/amd64
203
- freebsd/arm
204
- freebsd/arm64
205
- illumos/amd64
206
- js/wasm
207
- linux/386
208
- linux/amd64
209
- linux/arm
210
- linux/arm64
211
- linux/mips
212
- linux/mips64
213
- linux/mips64le
214
- linux/mipsle
215
- linux/ppc64
216
- linux/ppc64le
217
- linux/riscv64
218
- linux/s390x
219
- netbsd/386
220
- netbsd/amd64
221
- netbsd/arm
222
- netbsd/arm64
223
- openbsd/386
224
- openbsd/amd64
225
- openbsd/arm
226
- openbsd/arm64
227
- plan9/386
228
- plan9/amd64
229
- plan9/arm
230
- solaris/amd64
231
- windows/386
232
- windows/amd64
233
- windows/arm`
Original file line number Diff line number Diff line change
1
+ aix/ppc64
2
+ android/386
3
+ android/amd64
4
+ android/arm
5
+ android/arm64
6
+ darwin/amd64
7
+ darwin/arm64
8
+ dragonfly/amd64
9
+ freebsd/386
10
+ freebsd/amd64
11
+ freebsd/arm
12
+ freebsd/arm64
13
+ freebsd/riscv64
14
+ illumos/amd64
15
+ ios/amd64
16
+ ios/arm64
17
+ js/wasm
18
+ linux/386
19
+ linux/amd64
20
+ linux/arm
21
+ linux/arm64
22
+ linux/loong64
23
+ linux/mips
24
+ linux/mips64
25
+ linux/mips64le
26
+ linux/mipsle
27
+ linux/ppc64
28
+ linux/ppc64le
29
+ linux/riscv64
30
+ linux/s390x
31
+ netbsd/386
32
+ netbsd/amd64
33
+ netbsd/arm
34
+ netbsd/arm64
35
+ openbsd/386
36
+ openbsd/amd64
37
+ openbsd/arm
38
+ openbsd/arm64
39
+ openbsd/mips64
40
+ plan9/386
41
+ plan9/amd64
42
+ plan9/arm
43
+ solaris/amd64
44
+ windows/386
45
+ windows/amd64
46
+ windows/arm
47
+ windows/arm64
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package bindown
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
+ "runtime"
6
7
)
7
8
8
9
// SystemInfo contains os and architecture for a target system
@@ -24,6 +25,11 @@ func (s *SystemInfo) String() string {
24
25
25
26
// UnmarshalText implements encoding.TextUnmarshaler
26
27
func (s * SystemInfo ) UnmarshalText (text []byte ) error {
28
+ if string (text ) == "current" {
29
+ s .OS = runtime .GOOS
30
+ s .Arch = runtime .GOARCH
31
+ return nil
32
+ }
27
33
parts := bytes .Split (text , []byte {'/' })
28
34
if len (parts ) != 2 {
29
35
return fmt .Errorf (`systemInfo must be in the form "os/architecture"` )
You can’t perform that action at this time.
0 commit comments