mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Merge pull request #42 from ByteDream/v3/feature/info-command
Add info command
This commit is contained in:
commit
7b16938b52
1 changed files with 40 additions and 0 deletions
40
cmd/crunchyroll-go/cmd/info.go
Normal file
40
cmd/crunchyroll-go/cmd/info.go
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/ByteDream/crunchyroll-go/v3/utils"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var infoCmd = &cobra.Command{
|
||||||
|
Use: "info",
|
||||||
|
Short: "Shows information about the logged in user",
|
||||||
|
Args: cobra.MinimumNArgs(0),
|
||||||
|
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
loadCrunchy()
|
||||||
|
|
||||||
|
return info()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(infoCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func info() error {
|
||||||
|
account, err := crunchy.Account()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Username: ", account.Username)
|
||||||
|
fmt.Println("Email: ", account.Email)
|
||||||
|
fmt.Println("Premium: ", crunchy.Config.Premium)
|
||||||
|
fmt.Println("Interface language:", utils.LocaleLanguage(account.PreferredCommunicationLanguage))
|
||||||
|
fmt.Println("Subtitle language: ", utils.LocaleLanguage(account.PreferredContentSubtitleLanguage))
|
||||||
|
fmt.Println("Created: ", account.Created)
|
||||||
|
fmt.Println("Account ID: ", account.AccountID)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue