Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit c69c791

Browse files
author
Russtopia
authored
Merge pull request #54 from cdr/53-detect-missing-protocol
login: detect missing protocol in URL
2 parents fe97a29 + 75ff540 commit c69c791

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: cmd/coder/login.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"net"
55
"net/http"
66
"net/url"
7+
"strings"
78
"sync"
89

910
"github.com/pkg/browser"
@@ -22,13 +23,13 @@ type loginCmd struct {
2223
func (cmd loginCmd) Spec() cli.CommandSpec {
2324
return cli.CommandSpec{
2425
Name: "login",
25-
Usage: "[Coder Enterprise URL]",
26+
Usage: "[Coder Enterprise URL eg. http://my.coder.domain/ ]",
2627
Desc: "authenticate this client for future operations",
2728
}
2829
}
2930
func (cmd loginCmd) Run(fl *pflag.FlagSet) {
3031
rawURL := fl.Arg(0)
31-
if rawURL == "" {
32+
if rawURL == "" || !strings.HasPrefix(rawURL, "http") {
3233
exitUsage(fl)
3334
}
3435

0 commit comments

Comments
 (0)