Skip to content

Commit 7250695

Browse files
authored
Merge branch 'main' into projectlist
2 parents 23473e9 + 59ee22d commit 7250695

File tree

8 files changed

+48
-30
lines changed

8 files changed

+48
-30
lines changed

cli/login.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func login() *cobra.Command {
153153

154154
authURL := *serverURL
155155
authURL.Path = serverURL.Path + "/cli-auth"
156-
if err := openURL(authURL.String()); err != nil {
156+
if err := openURL(cmd, authURL.String()); err != nil {
157157
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Open the following in your browser:\n\n\t%s\n\n", authURL.String())
158158
} else {
159159
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Your browser has been opened to visit:\n\n\t%s\n\n", authURL.String())
@@ -211,21 +211,22 @@ func isWSL() (bool, error) {
211211
}
212212

213213
// openURL opens the provided URL via user's default browser
214-
func openURL(urlToOpen string) error {
215-
var cmd string
216-
var args []string
217-
214+
func openURL(cmd *cobra.Command, urlToOpen string) error {
215+
noOpen, err := cmd.Flags().GetBool(varNoOpen)
216+
if err != nil {
217+
panic(err)
218+
}
219+
if noOpen {
220+
return xerrors.New("opening is blocked")
221+
}
218222
wsl, err := isWSL()
219223
if err != nil {
220224
return xerrors.Errorf("test running Windows Subsystem for Linux: %w", err)
221225
}
222226

223227
if wsl {
224-
cmd = "cmd.exe"
225-
args = []string{"/c", "start"}
226-
urlToOpen = strings.ReplaceAll(urlToOpen, "&", "^&")
227-
args = append(args, urlToOpen)
228-
return exec.Command(cmd, args...).Start()
228+
// #nosec
229+
return exec.Command("cmd.exe", "/c", "start", strings.ReplaceAll(urlToOpen, "&", "^&")).Start()
229230
}
230231

231232
return browser.OpenURL(urlToOpen)

cli/login_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestLogin(t *testing.T) {
6969
})
7070
require.NoError(t, err)
7171

72-
root, _ := clitest.New(t, "login", client.URL.String(), "--force-tty")
72+
root, _ := clitest.New(t, "login", client.URL.String(), "--force-tty", "--no-open")
7373
pty := ptytest.New(t)
7474
root.SetIn(pty.Input())
7575
root.SetOut(pty.Output())
@@ -94,7 +94,7 @@ func TestLogin(t *testing.T) {
9494
})
9595
require.NoError(t, err)
9696

97-
root, _ := clitest.New(t, "login", client.URL.String(), "--force-tty")
97+
root, _ := clitest.New(t, "login", client.URL.String(), "--force-tty", "--no-open")
9898
pty := ptytest.New(t)
9999
root.SetIn(pty.Input())
100100
root.SetOut(pty.Output())

cli/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var (
2424

2525
const (
2626
varGlobalConfig = "global-config"
27+
varNoOpen = "no-open"
2728
varForceTty = "force-tty"
2829
)
2930

@@ -75,6 +76,11 @@ func Root() *cobra.Command {
7576
// This should never return an error, because we just added the `--force-tty`` flag prior to calling MarkHidden.
7677
panic(err)
7778
}
79+
cmd.PersistentFlags().Bool(varNoOpen, false, "Block automatically opening URLs in the browser.")
80+
err = cmd.PersistentFlags().MarkHidden(varNoOpen)
81+
if err != nil {
82+
panic(err)
83+
}
7884

7985
return cmd
8086
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# For interesting types of variables, check out the terraform docs:
2+
# https://www.terraform.io/language/values/variables#declaring-an-input-variable
3+
variable "message" {
4+
type = string
5+
}
6+
7+
# And refer to the docs on using expressions to make use of variables:
8+
# https://www.terraform.io/language/expressions/strings#interpolation
9+
output "hello_provisioner" {
10+
value = "Hello, provisioner: ${var.message}"
11+
}

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ replace github.com/hashicorp/terraform-config-inspect => github.com/kylecarbs/te
1414
// Required until https://github.com/chzyer/readline/pull/198 is merged.
1515
replace github.com/chzyer/readline => github.com/kylecarbs/readline v0.0.0-20220211054233-0d62993714c8
1616

17+
// Required until https://github.com/pion/ice/pull/425 is merged.
18+
replace github.com/pion/ice/v2 => github.com/kylecarbs/ice/v2 v2.1.8-0.20220221162453-b262a62902c3
19+
1720
require (
1821
cdr.dev/slog v1.4.1
1922
github.com/briandowns/spinner v1.18.1
@@ -114,7 +117,7 @@ require (
114117
github.com/pion/sdp/v3 v3.0.4 // indirect
115118
github.com/pion/srtp/v2 v2.0.5 // indirect
116119
github.com/pion/stun v0.3.5 // indirect
117-
github.com/pion/turn/v2 v2.0.6 // indirect
120+
github.com/pion/turn/v2 v2.0.8 // indirect
118121
github.com/pion/udp v0.1.1 // indirect
119122
github.com/pkg/errors v0.9.1 // indirect
120123
github.com/pmezard/go-difflib v1.0.0 // indirect

go.sum

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
842842
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
843843
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
844844
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
845+
github.com/kylecarbs/ice/v2 v2.1.8-0.20220221162453-b262a62902c3 h1:/SkVJxNTLozVOnU5OAQhnwt5Nb7h15c1BHad6t4h5MM=
846+
github.com/kylecarbs/ice/v2 v2.1.8-0.20220221162453-b262a62902c3/go.mod h1:Op8jlPtjeiycsXh93Cs4jK82C9j/kh7vef6ztIOvtIQ=
845847
github.com/kylecarbs/promptui v0.8.1-0.20201231190244-d8f2159af2b2 h1:MUREBTh4kybLY1KyuBfSx+QPfTB8XiUHs6ZxUhOPTnU=
846848
github.com/kylecarbs/promptui v0.8.1-0.20201231190244-d8f2159af2b2/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ=
847849
github.com/kylecarbs/readline v0.0.0-20220211054233-0d62993714c8 h1:Y7O3Z3YeNRtw14QrtHpevU4dSjCkov0J40MtQ7Nc0n8=
@@ -1024,11 +1026,8 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
10241026
github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
10251027
github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E=
10261028
github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ=
1027-
github.com/pion/dtls/v2 v2.1.1/go.mod h1:qG3gA7ZPZemBqpEFqRKyURYdKEwFZQCGb7gv9T3ON3Y=
10281029
github.com/pion/dtls/v2 v2.1.2 h1:22Q1Jk9L++Yo7BIf9130MonNPfPVb+YgdYLeyQotuAA=
10291030
github.com/pion/dtls/v2 v2.1.2/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
1030-
github.com/pion/ice/v2 v2.1.20 h1:xpxXyX5b4WjCh/D905gzBeW/hbJxMEPx2ptVfrhVE6M=
1031-
github.com/pion/ice/v2 v2.1.20/go.mod h1:hEAldRzBhTtAfvlU1V/2/nLCMvveQWFKPNCop+63/Iw=
10321031
github.com/pion/interceptor v0.1.7 h1:HThW0tIIKT9RRoDWGURe8rlZVOx0fJHxBHpA0ej0+bo=
10331032
github.com/pion/interceptor v0.1.7/go.mod h1:Lh3JSl/cbJ2wP8I3ccrjh1K/deRGRn3UlSPuOTiHb6U=
10341033
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
@@ -1056,8 +1055,8 @@ github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6
10561055
github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A=
10571056
github.com/pion/transport v0.13.0 h1:KWTA5ZrQogizzYwPEciGtHPLwpAjE91FgXnyu+Hv2uY=
10581057
github.com/pion/transport v0.13.0/go.mod h1:yxm9uXpK9bpBBWkITk13cLo1y5/ur5VQpG22ny6EP7g=
1059-
github.com/pion/turn/v2 v2.0.6 h1:AsXjSPR6Im15DMTB39NlfdTY9BQfieANPBjdg/aVNwY=
1060-
github.com/pion/turn/v2 v2.0.6/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw=
1058+
github.com/pion/turn/v2 v2.0.8 h1:KEstL92OUN3k5k8qxsXHpr7WWfrdp7iJZHx99ud8muw=
1059+
github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw=
10611060
github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
10621061
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
10631062
github.com/pion/webrtc/v3 v3.1.23 h1:suyNiF9o2/6SBsyWA1UweraUWYkaHCNJdt/16b61I5w=
@@ -1327,7 +1326,6 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
13271326
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
13281327
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
13291328
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
1330-
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
13311329
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE=
13321330
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
13331331
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1443,7 +1441,6 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx
14431441
golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
14441442
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
14451443
golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1446-
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
14471444
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
14481445
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
14491446
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=

site/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@typescript-eslint/eslint-plugin": "4.33.0",
3737
"@typescript-eslint/parser": "4.33.0",
3838
"eslint": "7.32.0",
39-
"eslint-config-prettier": "8.3.0",
39+
"eslint-config-prettier": "8.4.0",
4040
"eslint-import-resolver-alias": "1.1.2",
4141
"eslint-import-resolver-typescript": "2.5.0",
4242
"eslint-plugin-compat": "4.0.2",
@@ -58,7 +58,7 @@
5858
"react": "17.0.2",
5959
"react-dom": "17.0.2",
6060
"sql-formatter": "^4.0.2",
61-
"swr": "1.2.1",
61+
"swr": "1.2.2",
6262
"ts-jest": "27.1.3",
6363
"ts-loader": "9.2.6",
6464
"ts-node": "10.5.0",

site/yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5700,10 +5700,10 @@ escodegen@^2.0.0:
57005700
optionalDependencies:
57015701
source-map "~0.6.1"
57025702

5703-
eslint-config-prettier@8.3.0:
5704-
version "8.3.0"
5705-
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
5706-
integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
5703+
eslint-config-prettier@8.4.0:
5704+
version "8.4.0"
5705+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.4.0.tgz#8e6d17c7436649e98c4c2189868562921ef563de"
5706+
integrity sha512-CFotdUcMY18nGRo5KGsnNxpznzhkopOcOo0InID+sgQssPrzjvsyKZPvOgymTFeHrFuC3Tzdf2YndhXtULK9Iw==
57075707

57085708
eslint-import-resolver-alias@1.1.2:
57095709
version "1.1.2"
@@ -11386,10 +11386,10 @@ supports-preserve-symlinks-flag@^1.0.0:
1138611386
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
1138711387
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
1138811388

11389-
swr@1.2.1:
11390-
version "1.2.1"
11391-
resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.1.tgz#c21a4fe2139cb1c4630450589b5b5add947a9d41"
11392-
integrity sha512-1cuWXqJqXcFwbgONGCY4PHZ8v05009JdHsC3CIC6u7d00kgbMswNr1sHnnhseOBxtzVqcCNpOHEgVDciRer45w==
11389+
swr@1.2.2:
11390+
version "1.2.2"
11391+
resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.2.tgz#6cae09928d30593a7980d80f85823e57468fac5d"
11392+
integrity sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw==
1139311393

1139411394
symbol-tree@^3.2.4:
1139511395
version "3.2.4"

0 commit comments

Comments
 (0)