Be a bit more verbose regarding actions
Signed-off-by: Shin'ya Minazuki <shinyoukai@laidback.moe>
This commit is contained in:
22
login.go
22
login.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
@@ -62,9 +63,20 @@ func signin(cli *client.Client) {
|
||||
|
||||
token := strings.Trim(fmt.Sprintf(res.Token), "{}")
|
||||
|
||||
fmt.Println("Login successful")
|
||||
fmt.Println("Place this token in your configuration file for later use")
|
||||
fmt.Println("Do not share it with anyone, it's classified information!")
|
||||
fmt.Println("")
|
||||
fmt.Printf("token = %v\n", token)
|
||||
config, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
configPath := config + "/mikuru.ini"
|
||||
|
||||
f, err := os.OpenFile(configPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
f.WriteString("token = " + token + "\n")
|
||||
|
||||
log.Info("Login successful")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user