mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:46:45 +08:00
add a option to add a platform
This commit is contained in:
1 parent
8a0f6210d9
commit
17b3d9fda5
2 files changed
+6
-4
No files matched your search
@@ -9,17 +9,18 @@ import (
|
||||
)
|
||||
|
||||
var createAccountCmd = &cobra.Command{
|
||||
Use: "account [username] [email] [classicToken]",
|
||||
Use: "account [username] [email] [classicToken] [platform]",
|
||||
Short: "Create or update an account",
|
||||
Args: cobra.ExactArgs(3),
|
||||
Args: cobra.ExactArgs(4),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
account := utils.Account{
|
||||
Username: args[0],
|
||||
Email: args[1],
|
||||
ClassicToken: args[2],
|
||||
Platform: args[3],
|
||||
}
|
||||
if strings.TrimSpace(account.Username) == "" || strings.TrimSpace(account.Email) == "" || strings.TrimSpace(account.ClassicToken) == "" {
|
||||
return fmt.Errorf("username, email, and classicToken are required")
|
||||
if strings.TrimSpace(account.Username) == "" || strings.TrimSpace(account.Email) == "" || strings.TrimSpace(account.ClassicToken) == "" || strings.TrimSpace(account.Platform) == "" {
|
||||
return fmt.Errorf("username, email, classicToken, platform are required")
|
||||
}
|
||||
|
||||
if err := utils.UpsertAccount(account); err != nil { return err }
|
||||
|
||||
@@ -15,6 +15,7 @@ type Account struct {
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
ClassicToken string `json:"classic_token"`
|
||||
Platform string `json:"platform"`
|
||||
}
|
||||
|
||||
func AccountsFilePath() (string, error) {
|
||||
|
||||
Reference in new issue
Block a user