Skip to content

Commit 26a7f29

Browse files
authored
Feat/self update command (#25)
* fix: add .exe to the end of the windows binary feat: add self-update subcommand * fix: bump deps fix: add update command fix: error on unable to create launcher * fix: update close mechanism * fix: close tabs in browesr
1 parent c08afec commit 26a7f29

File tree

7 files changed

+182
-91
lines changed

7 files changed

+182
-91
lines changed

cmd/awscliauth.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import (
55
"fmt"
66
"os"
77
"path"
8+
"runtime"
89

910
"github.com/DevLabFoundry/aws-cli-auth/internal/credentialexchange"
11+
"github.com/Ensono/eirctl/selfupdate"
1012
"github.com/spf13/cobra"
1113
)
1214

@@ -68,10 +70,19 @@ NB: This cannot be higher than the 3600 as the API does not allow for AssumeRole
6870
//
6971
// IF you are making your sub commands public, you can just pass them directly `WithSubCommands`
7072
func SubCommands() []func(*Root) {
73+
suffix := fmt.Sprintf("aws-cli-auth-%s", runtime.GOOS)
74+
if runtime.GOOS == "windows" {
75+
suffix = suffix + "-" + runtime.GOARCH
76+
}
77+
78+
uc := selfupdate.New("aws-cli-auth", "https://github.com/DevLabFoundry/aws-cli-auth/releases", selfupdate.WithDownloadSuffix(suffix))
7179
return []func(*Root){
7280
newSamlCmd,
7381
newClearCmd,
7482
newSpecificIdentityCmd,
83+
func(rootCmd *Root) {
84+
uc.AddToRootCommand(rootCmd.Cmd)
85+
},
7586
}
7687
}
7788

eirctl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ tasks:
7676
- |
7777
mkdir -p .deps
7878
ldflags="-s -w -X \"github.com/{{.RepoOwner}}/{{.BinName}}/cmd.Version={{.Version}}\" -X \"github.com/{{.RepoOwner}}/{{.BinName}}/cmd.Revision={{.Revision}}\" -extldflags -static"
79-
CGO_ENABLED=0 GOPATH=$PWD/.deps GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} go build -mod=readonly -buildvcs=false -ldflags="$ldflags" -o dist/{{.BinName}}-${BUILD_GOOS}-${BUILD_GOARCH} .
79+
CGO_ENABLED=0 GOPATH=$PWD/.deps GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} go build -mod=readonly -buildvcs=false -ldflags="$ldflags" -o dist/{{.BinName}}-${BUILD_GOOS}-${BUILD_GOARCH}.exe .
8080
variations:
8181
- BUILD_GOOS: windows
8282
BUILD_GOARCH: amd64

go.mod

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,54 @@
11
module github.com/DevLabFoundry/aws-cli-auth
22

3-
go 1.25.1
3+
go 1.25.4
44

55
require (
6-
github.com/aws/aws-sdk-go-v2 v1.38.1
7-
github.com/aws/aws-sdk-go-v2/config v1.31.2
8-
github.com/aws/aws-sdk-go-v2/service/sts v1.38.0
9-
github.com/aws/smithy-go v1.22.5
6+
github.com/aws/aws-sdk-go-v2 v1.39.6
7+
github.com/aws/aws-sdk-go-v2/config v1.31.20
8+
github.com/aws/aws-sdk-go-v2/service/sts v1.40.2
9+
github.com/aws/smithy-go v1.23.2
1010
github.com/go-rod/rod v0.116.2
11-
github.com/spf13/cobra v1.9.1
11+
github.com/spf13/cobra v1.10.1
1212
github.com/werf/lockgate v0.1.1
1313
github.com/zalando/go-keyring v0.2.6
1414
gopkg.in/ini.v1 v1.67.0
1515
)
1616

17+
require (
18+
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
19+
github.com/rivo/uniseg v0.4.7 // indirect
20+
github.com/schollz/progressbar/v3 v3.18.0 // indirect
21+
golang.org/x/term v0.37.0 // indirect
22+
)
23+
1724
require (
1825
al.essio.dev/pkg/shellescape v1.6.0 // indirect
1926
dario.cat/mergo v1.0.2
20-
github.com/aws/aws-sdk-go-v2/credentials v1.18.6 // indirect
21-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.4 // indirect
22-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.4 // indirect
23-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.4 // indirect
24-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
25-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0 // indirect
26-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.4 // indirect
27-
github.com/aws/aws-sdk-go-v2/service/sso v1.28.2 // indirect
28-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.33.2 // indirect
29-
github.com/danieljoos/wincred v1.2.2 // indirect
27+
github.com/Ensono/eirctl v0.9.6
28+
github.com/aws/aws-sdk-go-v2/credentials v1.18.24 // indirect
29+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect
30+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect
31+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect
32+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect
35+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.3 // indirect
36+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.7 // indirect
37+
github.com/danieljoos/wincred v1.2.3 // indirect
3038
github.com/go-test/deep v1.1.1
3139
github.com/godbus/dbus/v5 v5.1.0 // indirect
32-
github.com/gofrs/flock v0.12.1 // indirect
40+
github.com/gofrs/flock v0.13.0 // indirect
3341
github.com/google/uuid v1.6.0 // indirect
3442
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3543
github.com/spaolacci/murmur3 v1.1.0 // indirect
36-
github.com/spf13/pflag v1.0.7 // indirect
37-
github.com/ysmood/fetchup v0.5.2 // indirect
44+
github.com/spf13/pflag v1.0.10 // indirect
45+
github.com/ysmood/fetchup v0.5.3 // indirect
3846
github.com/ysmood/goob v0.4.0 // indirect
39-
github.com/ysmood/got v0.41.0 // indirect
47+
github.com/ysmood/got v0.42.0 // indirect
4048
github.com/ysmood/gson v0.7.3 // indirect
4149
github.com/ysmood/leakless v0.9.0 // indirect
42-
golang.org/x/crypto v0.41.0 // indirect
43-
golang.org/x/sys v0.35.0 // indirect
50+
golang.org/x/crypto v0.44.0 // indirect
51+
golang.org/x/sys v0.38.0 // indirect
4452
)
4553

4654
replace github.com/ysmood/fetchup => github.com/ysmood/fetchup v0.3.0

0 commit comments

Comments
 (0)