diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-06-16 23:01:52 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-06-16 23:01:52 +0530 |
commit | c45cb6ebe10084d10f4fcf6189f26199f0913402 (patch) | |
tree | ecc39f3e2db66903ebea06b54edbd1423db7a09a | |
parent | 24ea0db80befd3bf5a67781084f48f0fa764d74f (diff) |
renamed Init to init function in mal because it should be called automatically
-rw-r--r-- | cmd/login.go | 2 | ||||
-rw-r--r-- | cmd/root.go | 11 | ||||
-rw-r--r-- | cmd/search.go | 2 | ||||
-rw-r--r-- | cmd/status.go | 1 | ||||
-rw-r--r-- | cmd/user_info.go | 23 | ||||
-rw-r--r-- | mal/mal.go | 2 |
6 files changed, 26 insertions, 15 deletions
diff --git a/cmd/login.go b/cmd/login.go index 74a6947..d483767 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -25,7 +25,7 @@ import ( var loginCmd = &cobra.Command { Use: "login", - Short: "Login with your MyAnimeList client secret", + Short: "Login with your MyAnimeList account.", Long: ``, Run: func(cmd *cobra.Command, args []string) { auth.Login() diff --git a/cmd/root.go b/cmd/root.go index e23a221..0914da1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -27,6 +27,17 @@ import ( var rootCmd = &cobra.Command{ Use: "macli", Short: "macli - Unofficial CLI-Based MyAnimeList Client.", + Long: "macli is an unofficial MyAnimeClient for use inside the terminal.\n" + +"\n" + +"\x1b[34mmacli Copyright (C) 2022 Vidhu Kant Sharma <vidhukant@vidhukant.xyz>\n" + +"This program comes with ABSOLUTELY NO WARRANTY;\n" + +"This is free software, and you are welcome to redistribute it\n" + +"under certain conditions; For details refer to the GNU General Public License.\n" + +"You should have received a copy of the GNU General Public License\n" + +"along with this program. If not, see <https://www.gnu.org/licenses/>.\x1b[0m\n" + +"\n" + +"\x1b[35mPlease report any bugs on the GitHub page https://github.com/MikunoNaka/macli\n" + +"or through email: vidhukant@vidhukant.xyz\x1b[0m\n", } func Execute() { diff --git a/cmd/search.go b/cmd/search.go index 5f97861..da57862 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -22,7 +22,6 @@ import ( "strings" "github.com/spf13/cobra" "github.com/MikunoNaka/macli/ui" - "github.com/MikunoNaka/macli/mal" ) var searchCmd = &cobra.Command { @@ -32,7 +31,6 @@ var searchCmd = &cobra.Command { -- help/description to be added later `, Run: func(cmd *cobra.Command, args []string) { - mal.Init() // needs to be manually called else it won't let you login // read searchInput from command searchInput := strings.Join(args, " ") mangaMode, _ := cmd.Flags().GetBool("manga") diff --git a/cmd/status.go b/cmd/status.go index 048bd70..e80386c 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -35,7 +35,6 @@ var statusCmd = &cobra.Command{ -- help/description to be added later `, Run: func(cmd *cobra.Command, args []string) { - mal.Init() // needs to be manually called else it won't let you login searchInput := strings.Join(args, " ") statusInput, err := cmd.Flags().GetString("status") diff --git a/cmd/user_info.go b/cmd/user_info.go index 2da34aa..7c9387a 100644 --- a/cmd/user_info.go +++ b/cmd/user_info.go @@ -26,19 +26,22 @@ import ( var userInfoCmd = &cobra.Command { Use: "user-info", - Short: "prints authenticated user's info", - Long: ``, + Short: "Shows logged-in user's info", + Long: +`Print logged-in user's profile information. +Currently, MyAnimeList doesn't allow reading of other users' profiles +`, Run: func(cmd *cobra.Command, args []string) { userInfo := mal.GetUserInfo() - fmt.Printf("\x1b[1;34mUsername: \t%s\n\x1b[0m", userInfo.Name) - fmt.Printf("\x1b[1;34mProfile Picture: \t%s\n\x1b[0m", userInfo.Picture) - fmt.Printf("\x1b[1;34mGender: \t%s\n\x1b[0m", userInfo.Gender) - fmt.Printf("\x1b[1;34mLocation: \t%s\n\x1b[0m", userInfo.Location) - fmt.Printf("\x1b[1;34mBirthday: \t%s\n\x1b[0m", userInfo.Birthday) - fmt.Printf("\x1b[1;34mTime Zone: \t%s\n\x1b[0m", userInfo.TimeZone) - fmt.Printf("\x1b[1;34mJoined At: \t%s\n\x1b[0m", userInfo.JoinedAt) - fmt.Printf("\x1b[1;34mUser ID: \t%d\n\x1b[0m", userInfo.Id) + fmt.Printf("\x1b[1;34mUsername: %s\n\x1b[0m", userInfo.Name) + fmt.Printf("\x1b[1;34mProfile Picture: %s\n\x1b[0m", userInfo.Picture) + fmt.Printf("\x1b[1;34mGender: %s\n\x1b[0m", userInfo.Gender) + fmt.Printf("\x1b[1;34mLocation: %s\n\x1b[0m", userInfo.Location) + fmt.Printf("\x1b[1;34mBirthday: %s\n\x1b[0m", userInfo.Birthday) + fmt.Printf("\x1b[1;34mTime Zone: %s\n\x1b[0m", userInfo.TimeZone) + fmt.Printf("\x1b[1;34mJoined At: %s\n\x1b[0m", userInfo.JoinedAt) + fmt.Printf("\x1b[1;34mUser ID: %d\n\x1b[0m", userInfo.Id) if userInfo.IsSupporter { fmt.Printf("\x1b[33mYou are a MyAnimeList Supporter.\n\x1b[0m") @@ -33,7 +33,7 @@ var userClient u.Client var userAnimeClient ua.Client var userMangaClient um.Client -func Init() { +func init() { secret := auth.GetToken() // initialise MAL2Go Client(s) |