Skip to content

Commit 54dacfc

Browse files
committed
Updates to add user's email in fetch + uses cyan throughout
1 parent 70dd1ac commit 54dacfc

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

cmd/fetch.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ var FetchCmd = &cobra.Command{
4040
red := color.New(color.FgRed, color.Bold)
4141
red.Printf("You're not logged in yet! Please use `getgif login` before using `fetch`.\n")
4242
} else {
43+
cyan := color.New(color.FgCyan)
44+
cyan.Printf("Hey %s, looks like you already logged in so fetching your gif now...\n", user.Email)
45+
4346
gifURL, err := fetchGif()
4447
if err != nil {
4548
log.Fatal(err)
4649
}
4750

51+
// Wait a couple seconds to give user a chance to read the message above.
52+
time.Sleep(2 * time.Second)
53+
4854
open.Run(gifURL)
4955
}
5056
},

cmd/login.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
faClient *fusionauth.FusionAuthClient
2727
)
2828

29-
// LoginCmd provides the subcommand for logging into the FA server using the Device Flow.
29+
// LoginCmd provides the command for logging into the FA server using the Device Flow.
3030
var LoginCmd = &cobra.Command{
3131
Use: "login",
3232
Short: "Authenticate to the FA server using the OAuth Device Flow.",
@@ -57,7 +57,7 @@ func startDeviceGrantFlow(deviceAuthEndpoint string) (*fusionauth.DeviceResponse
5757
var result *fusionauth.DeviceResponse = &fusionauth.DeviceResponse{}
5858

5959
resp, err := http.PostForm(deviceAuthEndpoint, url.Values{
60-
"client_id": {"7dde5f47-5000-4580-8003-b3b8d1cbe2e9"},
60+
"client_id": {ClientID},
6161
"scope": {"offline_access"},
6262
"metaData.device.name": {"Golang CLI App"},
6363
"metaData.device.type": {string(fusionauth.DeviceType_OTHER)},
@@ -77,10 +77,10 @@ func informUserAndOpenBrowser(userCode string) {
7777
cyan := color.New(color.FgCyan)
7878
cyan.Printf("Your User Code is: ")
7979

80-
red := color.New(color.FgRed, color.Bold)
81-
red.Printf("%s\n", userCode)
80+
yellow := color.New(color.FgYellow, color.Bold)
81+
yellow.Printf("%s\n", userCode)
8282

83-
fmt.Printf("Opening browser for code entry...\n")
83+
cyan.Printf("Opening browser for code entry...\n")
8484

8585
// Wait a few seconds to give user a chance to check out the printed user code.
8686
time.Sleep(3 * time.Second)
@@ -139,6 +139,6 @@ func fetchAndSaveUser(token *fusionauth.AccessToken) {
139139
// Save our User object for later usage in fetch
140140
Save("/tmp/getgif.json", resp.User)
141141

142-
mag := color.New(color.FgMagenta)
143-
mag.Printf("You successfully authenticated! You can now use `getgif fetch`!\n")
142+
cyan := color.New(color.FgCyan)
143+
cyan.Printf("You successfully authenticated! You can now use `getgif fetch`!\n")
144144
}

cmd/logout.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var LogoutCmd = &cobra.Command{
1212
Run: func(cmd *cobra.Command, args []string) {
1313
Remove("/tmp/getgif.json")
1414

15-
mag := color.New(color.FgMagenta)
16-
mag.Printf("You've been logged out!\n")
15+
cyan := color.New(color.FgCyan)
16+
cyan.Printf("You've been logged out!\n")
1717
},
1818
}

0 commit comments

Comments
 (0)