From 747e4795424c6f9112f0e64bcb434df42b2ba8c5 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 26 Nov 2022 14:30:11 +0530 Subject: fixed help messages, etc --- cmd/about.go | 2 +- cmd/chapters.go | 9 +++++---- cmd/episodes.go | 5 +++-- cmd/list.go | 22 ++++++++++------------ cmd/login.go | 4 ++-- cmd/score.go | 4 ++-- cmd/status.go | 7 ++++--- cmd/version.go | 2 +- cmd/volumes.go | 3 ++- mal/list.go | 8 ++++---- 10 files changed, 34 insertions(+), 32 deletions(-) diff --git a/cmd/about.go b/cmd/about.go index 5a4e426..9fca780 100644 --- a/cmd/about.go +++ b/cmd/about.go @@ -40,7 +40,7 @@ var aboutCmd = &cobra.Command{ "\x1b[35mPlease report any bugs on the GitHub page: https://github.com/MikunoNaka/macli\n" + "or through email: vidhukant@vidhukant.xyz\x1b[0m\n\n", ) - fmt.Println("Visit \x1b[36mhttps://www.vidhukant.xyz/projects/macli/\x1b[0m for more info.") + fmt.Println("Visit \x1b[36mhttps://www.vidhukant.xyz/docs/macli/\x1b[0m for more info.") fmt.Println("Run \x1b[33m`macli --help`\x1b[0m for instructions.") }, } diff --git a/cmd/chapters.go b/cmd/chapters.go index 15e2169..d65d270 100644 --- a/cmd/chapters.go +++ b/cmd/chapters.go @@ -37,10 +37,11 @@ var chaptersCmd = &cobra.Command{ Long: "Set the number of chapters read" + "\n" + "Example Usage:\n" + - " - \x1b[33m`macli chapters `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + - " - \x1b[33m`macli chapters -s 4 `\x1b[0m to set the chapters to 4\n" + - " - \x1b[33m`macli chapters -s +1 `\x1b[0m to increment the chapters by 1\n" + - " - \x1b[33m`macli chapters -s -2 `\x1b[0m to decrement the chapters by 2\n", + " - \x1b[33m`macli chapters `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + + " - \x1b[33m`macli chapters -s 4 `\x1b[0m to set the chapters to 4\n" + + " - \x1b[33m`macli chapters -s +1 `\x1b[0m to increment the chapters by 1\n" + + " - \x1b[33m`macli chapters -s -2 `\x1b[0m to decrement the chapters by 2\n" + + " - \x1b[33m`macli chapters -S 1`\x1b[0m automatically selects the first search result\n", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindSearchConfig(cmd.Flags()) if err != nil { diff --git a/cmd/episodes.go b/cmd/episodes.go index a2dbd4d..57dbba5 100644 --- a/cmd/episodes.go +++ b/cmd/episodes.go @@ -40,7 +40,8 @@ var episodesCmd = &cobra.Command{ " - \x1b[33m`macli episodes `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + " - \x1b[33m`macli episodes -s 4 `\x1b[0m to set the episodes to 4\n" + " - \x1b[33m`macli episodes -s +1 `\x1b[0m to increment the episodes by 1\n" + - " - \x1b[33m`macli episodes -s -2 `\x1b[0m to decrement the episodes by 2\n", + " - \x1b[33m`macli episodes -s -2 `\x1b[0m to decrement the episodes by 2\n" + + " - \x1b[33m`macli episodes -S 1`\x1b[0m automatically selects the first search result\n", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindSearchConfig(cmd.Flags()) if err != nil { @@ -52,7 +53,7 @@ var episodesCmd = &cobra.Command{ mal.SearchNSFW = conf.SearchNSFW mal.AutoSel = conf.AutoSel ui.PromptLength = conf.PromptLength - mal.Init() + mal.Init() var selectedAnime a.Anime if entryId > 0 { diff --git a/cmd/list.go b/cmd/list.go index 16916a9..4a8cf38 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -31,14 +31,12 @@ import ( // statusCmd represents the status command var listCmd = &cobra.Command{ Use: "list", - Short: "Print out user's animelist", - Long: "To be added", // + - // "\n" + - // "Example Usage:\n" + - // " - \x1b[33m`macli chapters `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + - // " - \x1b[33m`macli chapters -s 4 `\x1b[0m to set the chapters to 4\n" + - // " - \x1b[33m`macli chapters -s +1 `\x1b[0m to increment the chapters by 1\n" + - // " - \x1b[33m`macli chapters -s -2 `\x1b[0m to decrement the chapters by 2\n", + Short: "Print out any user's animelist", + Long: "List any user's public anime/manga list." + + "\n" + + "Example Usage:\n" + + " - \x1b[33m`macli list`\x1b[0m prints your anime list (or manga list with \x1b[33m`-m`\x1b[0m switch) \n" + + " - Specify list status and user, etc with \x1b[33m`--status=dropped --user=0ZeroTsu --sort=list_score`\x1b[0m", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindListConfig(cmd.Flags()) if err != nil { @@ -69,18 +67,18 @@ var listCmd = &cobra.Command{ } if mangaMode { - ui.MangaList(mal.MangaList(user, status, sort, conf.IncludeNSFW)) + ui.MangaList(mal.MangaList(user, status, sort)) } else { - ui.AnimeList(mal.AnimeList(user, status, sort, conf.IncludeNSFW)) + ui.AnimeList(mal.AnimeList(user, status, sort)) } }, } func init() { rootCmd.AddCommand(listCmd) - listCmd.Flags().StringP("status", "", "", "Status (leave blank for all)") + listCmd.Flags().StringP("status", "", "", "Status (leave blank for all, possible values: watching, completed, on_hold, dropped, plan_to_watch)") listCmd.Flags().StringP("user", "", "@me", "User (@me or blank for self)") - listCmd.Flags().StringP("sort", "", "list_score", "Sort the list") + listCmd.Flags().StringP("sort", "", "list_score", "Sort the list (possible values: list_score, list_updated_at, anime_title, anime_start_date, anime_id)") listCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode") listCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)") diff --git a/cmd/login.go b/cmd/login.go index 92a4c92..453d744 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -20,7 +20,7 @@ package cmd import ( "os" - "fmt" + "fmt" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/MikunoNaka/macli/auth" @@ -38,7 +38,7 @@ var loginCmd = &cobra.Command { " - Inside the form you can set all the details to whatever you'd like\n" + " - For macli to work properly, you only need to set \x1b[33m\"App Redirect Url\"\x1b[0m to \x1b[36mhttp://localhost:8000\x1b[0m\n" + " - After that, hit submit, then copy your Client ID, run `macli login` and paste in your Client ID.\n" + - " - \x1b[31mIf after running `macli login` it opens a dialogue box in the browser asking for credentials,\n and not the MyAnimeList login page, that means you have entered your Client ID wrong.\x1b[0m\n" + + " - \x1b[31mIf after running `macli login` it opens a dialogue box in the browser asking for credentials,\n and not the MyAnimeList login page, that means you have entered your Client ID wrong. \n (you might need to wait for a few minutes after creating a new ID)\x1b[0m\n" + "", Run: func(cmd *cobra.Command, args []string) { var storeClientId bool diff --git a/cmd/score.go b/cmd/score.go index 57442fe..f7396e7 100644 --- a/cmd/score.go +++ b/cmd/score.go @@ -40,8 +40,8 @@ var scoreCmd = &cobra.Command{ Long: "Set an anime's status\n" + "\n" + "Example Usage:\n" + - " - \x1b[33m`macli status `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + - " - \x1b[33m`macli status -s \x1b[34mwatching|plan_to_watch|dropped|on_hold|completed\x1b[33m `\x1b[0m to specify status from command\n", + " - \x1b[33m`macli score `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + + " - \x1b[33m`macli score -s 10 `\x1b[0m to set score to 10 (use \x1b[33m-m\x1b[0m switch to set manga score instead)\n", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindSearchConfig(cmd.Flags()) if err != nil { diff --git a/cmd/status.go b/cmd/status.go index 0c92249..6b63def 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -38,8 +38,9 @@ var statusCmd = &cobra.Command{ Long: "Set an anime's status\n" + "\n" + "Example Usage:\n" + - " - \x1b[33m`macli status `\x1b[0m For interactive prompt (anime-name can be omitted)\n" + - " - \x1b[33m`macli status -s \x1b[34mwatching|plan_to_watch|dropped|on_hold|completed\x1b[33m `\x1b[0m to specify status from command\n", + " - \x1b[33m`macli status `\x1b[0m For interactive prompt (anime-name can be omitted, use \x1b[33m-m\x1b[0m switch for manga)\n" + + " - \x1b[33m`macli status -s \x1b[34mwatching|plan_to_watch|dropped|on_hold|completed\x1b[33m `\x1b[0m to specify status from command\n" + + " - \x1b[33m`macli status -S 1`\x1b[0m automatically selects the first search result\n", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindSearchConfig(cmd.Flags()) if err != nil { @@ -51,7 +52,7 @@ var statusCmd = &cobra.Command{ mal.AutoSel = conf.AutoSel mal.SearchNSFW = conf.SearchNSFW ui.PromptLength = conf.PromptLength - mal.Init() + mal.Init() searchInput := strings.Join(args, " ") diff --git a/cmd/version.go b/cmd/version.go index 62c0008..3a1e3c6 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" ) -const version string = "v1.14.1" +const version string = "v1.16.0" var versionCmd = &cobra.Command { Use: "version", diff --git a/cmd/volumes.go b/cmd/volumes.go index f1cc108..1fb54ce 100644 --- a/cmd/volumes.go +++ b/cmd/volumes.go @@ -40,7 +40,8 @@ var volumesCmd = &cobra.Command{ " - \x1b[33m`macli volumes `\x1b[0m For interactive prompt (manga-name can be omitted)\n" + " - \x1b[33m`macli volumes -s 4 `\x1b[0m to set the volumes to 4\n" + " - \x1b[33m`macli volumes -s +1 `\x1b[0m to increment the volumes by 1\n" + - " - \x1b[33m`macli volumes -s -2 `\x1b[0m to decrement the volumes by 2\n", + " - \x1b[33m`macli volumes -s -2 `\x1b[0m to decrement the volumes by 2\n" + + " - \x1b[33m`macli volumes -S 1`\x1b[0m automatically selects the first search result\n", Run: func(cmd *cobra.Command, args []string) { conf, err := util.BindSearchConfig(cmd.Flags()) if err != nil { diff --git a/mal/list.go b/mal/list.go index 82b4938..3e9e737 100644 --- a/mal/list.go +++ b/mal/list.go @@ -26,8 +26,8 @@ import ( ) // TODO: return all the list items using loop -func AnimeList(user, status, sort string, nsfw bool) []a.Anime { - res, _, err := userAnimeClient.GetAnimeList(user, status, sort, 1000, 0, nsfw, []string{"title", "num_episodes", "media_type"}) +func AnimeList(user, status, sort string) []a.Anime { + res, _, err := userAnimeClient.GetAnimeList(user, status, sort, 1000, 0, SearchNSFW, []string{"title", "num_episodes", "media_type"}) if err != nil { fmt.Println(err) os.Exit(1) @@ -36,8 +36,8 @@ func AnimeList(user, status, sort string, nsfw bool) []a.Anime { } // TODO: return all the list items using loop -func MangaList(user, status, sort string, nsfw bool) []m.Manga { - res, _, err := userMangaClient.GetMangaList(user, status, sort, 1000, 0, nsfw, []string{"title", "num_chapters", "num_volumes", "media_type"}) +func MangaList(user, status, sort string) []m.Manga { + res, _, err := userMangaClient.GetMangaList(user, status, sort, 1000, 0, SearchNSFW, []string{"title", "num_chapters", "num_volumes", "media_type"}) if err != nil { fmt.Println(err) os.Exit(1) -- cgit v1.2.3