aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-30 15:10:58 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-30 15:10:58 +0530
commitd67758bdbeb162adadb6b19954e8e22cf04ed388 (patch)
tree1438369c1d980ebb041a04264da6d9006473e967 /cmd
parent37b5c5457d51b50af1dcadaf7c85be7e7349d682 (diff)
reading both flags and config for searching commands
Diffstat (limited to 'cmd')
-rw-r--r--cmd/chapters.go25
-rw-r--r--cmd/episodes.go25
-rw-r--r--cmd/list.go12
-rw-r--r--cmd/login.go2
-rw-r--r--cmd/root.go41
-rw-r--r--cmd/score.go19
-rw-r--r--cmd/search.go19
-rw-r--r--cmd/seasonals.go7
-rw-r--r--cmd/status.go20
-rw-r--r--cmd/volumes.go25
10 files changed, 141 insertions, 54 deletions
diff --git a/cmd/chapters.go b/cmd/chapters.go
index 4e5be08..f8c3414 100644
--- a/cmd/chapters.go
+++ b/cmd/chapters.go
@@ -23,6 +23,7 @@ import (
"fmt"
"strings"
"github.com/MikunoNaka/macli/ui"
+ "github.com/MikunoNaka/macli/util"
"github.com/MikunoNaka/macli/mal"
m "github.com/MikunoNaka/MAL2Go/v4/manga"
@@ -41,7 +42,17 @@ var chaptersCmd = &cobra.Command{
" - \x1b[33m`macli chapters -s +1 <anime-name>`\x1b[0m to increment the chapters by 1\n" +
" - \x1b[33m`macli chapters -s -2 <anime-name>`\x1b[0m to decrement the chapters by 2\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
var selectedManga m.Manga
if entryId > 0 {
selectedManga = mal.GetMangaData(entryId, []string{"my_list_status", "num_chapters"})
@@ -58,10 +69,7 @@ var chaptersCmd = &cobra.Command{
searchInput = ui.TextInput(promptText, "Search can't be blank.")
}
- var (
- chInput string
- err error
- )
+ var chInput string
if !queryOnlyMode {
chInput, err = cmd.Flags().GetString("set-value")
if err != nil {
@@ -92,11 +100,12 @@ var chaptersCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(chaptersCmd)
chaptersCmd.Flags().StringP("set-value", "s", "", "Number of chapters")
- chaptersCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", promptLength, "Length of select prompt")
- chaptersCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", searchLength, "Amount of search results to load")
- chaptersCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", searchOffset, "Offset for the search results")
- chaptersCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", searchNsfw, "Include NSFW-rated items in search results")
chaptersCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
chaptersCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
chaptersCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ chaptersCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ chaptersCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ chaptersCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ chaptersCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}
diff --git a/cmd/episodes.go b/cmd/episodes.go
index 0423679..fce4b2a 100644
--- a/cmd/episodes.go
+++ b/cmd/episodes.go
@@ -23,6 +23,7 @@ import (
"fmt"
"strings"
"github.com/MikunoNaka/macli/ui"
+ "github.com/MikunoNaka/macli/util"
"github.com/MikunoNaka/macli/mal"
a "github.com/MikunoNaka/MAL2Go/v4/anime"
@@ -41,7 +42,17 @@ var episodesCmd = &cobra.Command{
" - \x1b[33m`macli episodes -s +1 <anime-name>`\x1b[0m to increment the episodes by 1\n" +
" - \x1b[33m`macli episodes -s -2 <anime-name>`\x1b[0m to decrement the episodes by 2\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
var selectedAnime a.Anime
if entryId > 0 {
selectedAnime = mal.GetAnimeData(entryId, []string{"my_list_status", "num_episodes"})
@@ -58,10 +69,7 @@ var episodesCmd = &cobra.Command{
searchInput = ui.TextInput(promptText, "Search can't be blank.")
}
- var (
- epInput string
- err error
- )
+ var epInput string
if !queryOnlyMode {
epInput, err = cmd.Flags().GetString("set-value")
if err != nil {
@@ -92,11 +100,12 @@ var episodesCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(episodesCmd)
episodesCmd.Flags().StringP("set-value", "s", "", "Number of episodes")
- episodesCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", promptLength, "Length of select prompt")
episodesCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
- episodesCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", searchLength, "Amount of search results to load")
- episodesCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", searchNsfw, "Include NSFW-rated items in search results")
- episodesCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", searchOffset, "Offset for the search results")
episodesCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
episodesCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ episodesCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ episodesCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ episodesCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ episodesCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}
diff --git a/cmd/list.go b/cmd/list.go
index e6f7f8c..e4dbcf1 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -26,6 +26,7 @@ import (
// m "github.com/MikunoNaka/MAL2Go/v4/manga"
"github.com/spf13/cobra"
+ "github.com/spf13/viper"
)
// statusCmd represents the status command
@@ -80,10 +81,13 @@ func init() {
listCmd.Flags().StringP("status", "", "", "Status (leave blank for all)")
listCmd.Flags().StringP("user", "", "@me", "User (@me or blank for self)")
listCmd.Flags().StringP("sort", "", "list_score", "Sort the list")
- listCmd.Flags().BoolP("include-nsfw", "", listIncludeNsfw, "Include NSFW results")
+ listCmd.Flags().BoolP("include-nsfw", "", false, "Include NSFW results")
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)")
- // TODO: implement below 2 flags
- // listCmd.Flags().IntVarP(&mal.SearchLength, "list-length", "n", listLength, "Amount of list items to load (default: all)")
- // listCmd.Flags().IntVarP(&mal.SearchOffset, "list-offset", "o", listOffset, "Offset for the list")
+ listCmd.Flags().IntVarP(&mal.SearchLength, "list-length", "n", 15, "Amount of list items to load (default: all)")
+ listCmd.Flags().IntVarP(&mal.SearchOffset, "list-offset", "o", 0, "Offset for the list")
+
+ viper.BindPFlag("lists.list_offset", listCmd.Flags().Lookup("list-offset"))
+ viper.BindPFlag("lists.list_length", listCmd.Flags().Lookup("list-length"))
+ viper.BindPFlag("lists.include_nsfw_results", listCmd.Flags().Lookup("include-nsfw"))
}
diff --git a/cmd/login.go b/cmd/login.go
index 7127c47..39bc7d4 100644
--- a/cmd/login.go
+++ b/cmd/login.go
@@ -64,5 +64,5 @@ func init() {
rootCmd.AddCommand(loginCmd)
loginCmd.Flags().StringP("authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
loginCmd.Flags().StringP("client-id", "c", "", "MyAnimeList Client ID")
- loginCmd.Flags().StringP("store-client-id", "s", saveClientId, "Save Client ID to keyring (yes/no) (Default: yes)")
+ loginCmd.Flags().StringP("store-client-id", "s", "yes", "Save Client ID to keyring")
}
diff --git a/cmd/root.go b/cmd/root.go
index 02d27a1..7b379a3 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -30,14 +30,14 @@ var (
queryOnlyMode, mangaMode bool
entryId int
- // auth
- saveClientId string = "yes"
- // searching
- promptLength, searchLength, searchOffset int = 5, 10, 0
- searchNsfw bool = false
- // lists
- listOffset, listLength int = 0, 15
- listIncludeNsfw bool = false
+ // // auth
+ // saveClientId string = "yes"
+ // // searching
+ // promptLength, searchLength, searchOffset int = 5, 10, 0
+ // searchNsfw bool = false
+ // // lists
+ // listOffset, listLength int = 0, 15
+ // listIncludeNsfw bool = false
)
var rootCmd = &cobra.Command{
@@ -46,12 +46,16 @@ var rootCmd = &cobra.Command{
Long: "macli is an unofficial MyAnimeList Client for use inside the terminal.",
}
-func Execute() {
+func init() {
+ cobra.OnInitialize(initConfig)
+}
+
+func initConfig() {
viper.SetConfigName("macli")
- viper.SetConfigType("yaml")
+ //viper.SetConfigType("yaml")
viper.AddConfigPath(".")
- viper.AddConfigPath("$HOME/.config/macli")
- viper.AddConfigPath("/etc/macli")
+ // viper.AddConfigPath("$HOME/.config/macli")
+ // viper.AddConfigPath("/etc/macli")
// dont show error if file not found
// macli doesnt need a config file to work properly
@@ -64,6 +68,19 @@ func Execute() {
}
}
+ viper.SetDefault("searching.prompt_length", 5)
+ viper.SetDefault("searching.search_length", 10)
+ viper.SetDefault("searching.search_offset", 0)
+ viper.SetDefault("searching.search_nsfw", false)
+
+ viper.SetDefault("lists.list_offset", 0)
+ viper.SetDefault("lists.list_length", 15)
+ viper.SetDefault("lists.include_nsfw_results", false)
+
+ viper.SetDefault("auth.save_client_id", "yes")
+}
+
+func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
diff --git a/cmd/score.go b/cmd/score.go
index ec26252..a7a5aaa 100644
--- a/cmd/score.go
+++ b/cmd/score.go
@@ -43,7 +43,17 @@ var scoreCmd = &cobra.Command{
" - \x1b[33m`macli status <anime-name>`\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 <anime-name>`\x1b[0m to specify status from command\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
searchInput := strings.Join(args, " ")
scoreInput, err := cmd.Flags().GetString("set-value")
@@ -159,12 +169,13 @@ func setMangaScore(scoreInput, searchInput string) {
func init() {
rootCmd.AddCommand(scoreCmd)
scoreCmd.Flags().StringP("set-value", "s", "", "Score to be set")
- scoreCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", promptLength, "Length of select prompt")
- scoreCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", searchLength, "Amount of search results to load")
- scoreCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", searchOffset, "Offset for the search results")
- scoreCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", searchNsfw, "Include NSFW-rated items in search results")
scoreCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
scoreCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
scoreCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
scoreCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ scoreCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ scoreCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ scoreCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ scoreCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}
diff --git a/cmd/search.go b/cmd/search.go
index 57f1980..0961ffe 100644
--- a/cmd/search.go
+++ b/cmd/search.go
@@ -41,7 +41,17 @@ var searchCmd = &cobra.Command {
"\t\x1b[33m`macli search -m <manga-name>`\x1b[0m searches for a manga\n" +
"\t\x1b[33m`macli search`\x1b[0m interactively asks for an anime to search for (same for manga with -m/--manga flag)\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
// read searchInput from command
searchInput := strings.Join(args, " ")
mangaMode, err := cmd.Flags().GetBool("manga")
@@ -114,12 +124,13 @@ func searchAnime(searchInput string) {
func init() {
rootCmd.AddCommand(searchCmd)
- searchCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", promptLength, "Length of select prompt")
searchCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
- searchCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", searchLength, "Amount of search results to load")
- searchCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", searchOffset, "Offset for the search results")
- searchCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", searchNsfw, "Include NSFW-rated items in search results")
searchCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
searchCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
searchCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ searchCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ searchCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ searchCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ searchCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}
diff --git a/cmd/seasonals.go b/cmd/seasonals.go
index 5efe544..b78876a 100644
--- a/cmd/seasonals.go
+++ b/cmd/seasonals.go
@@ -27,6 +27,7 @@ import (
"github.com/MikunoNaka/macli/mal"
"github.com/spf13/cobra"
+ "github.com/spf13/viper"
)
// statusCmd represents the status command
@@ -58,11 +59,15 @@ var seasonalsCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(seasonalsCmd)
- seasonalsCmd.Flags().IntVarP(&mal.SearchLength, "results-length", "n", 10, "Amount of results to load")
+ seasonalsCmd.Flags().IntVarP(&mal.SearchLength, "results-length", "n", 15, "Amount of results to load")
seasonalsCmd.Flags().BoolVarP(&mal.SearchNSFW, "include-nsfw", "", false, "Include NSFW-rated items in results")
seasonalsCmd.Flags().IntVarP(&mal.SearchOffset, "results-offset", "o", 0, "Offset for the results")
seasonalsCmd.Flags().StringP("sort", "", "anime_num_list_users", "sort")
seasonalsCmd.Flags().StringP("season", "", "", "")
seasonalsCmd.Flags().IntP("year", "", 0, "")
seasonalsCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ viper.BindPFlag("lists.list_length", seasonalsCmd.Flags().Lookup("results-length"))
+ viper.BindPFlag("lists.list_offset", seasonalsCmd.Flags().Lookup("results-offset"))
+ viper.BindPFlag("lists.include_nsfw_results", seasonalsCmd.Flags().Lookup("include-nsfw"))
}
diff --git a/cmd/status.go b/cmd/status.go
index 2dc6fee..7c641e6 100644
--- a/cmd/status.go
+++ b/cmd/status.go
@@ -23,6 +23,7 @@ import (
"os"
"strings"
"github.com/MikunoNaka/macli/ui"
+ "github.com/MikunoNaka/macli/util"
"github.com/MikunoNaka/macli/mal"
a "github.com/MikunoNaka/MAL2Go/v4/anime"
m "github.com/MikunoNaka/MAL2Go/v4/manga"
@@ -40,7 +41,17 @@ var statusCmd = &cobra.Command{
" - \x1b[33m`macli status <anime-name>`\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 <anime-name>`\x1b[0m to specify status from command\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
searchInput := strings.Join(args, " ")
statusInput, err := cmd.Flags().GetString("set-value")
@@ -135,12 +146,13 @@ func setMangaStatus(statusInput, searchInput string) {
func init() {
rootCmd.AddCommand(statusCmd)
statusCmd.Flags().StringP("set-value", "s", "", "status to be set")
- statusCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", 5, "Length of select prompt")
- statusCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", 10, "Amount of search results to load")
- statusCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", 0, "Offset for the search results")
- statusCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
statusCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
statusCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
statusCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
statusCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ statusCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ statusCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ statusCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ statusCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}
diff --git a/cmd/volumes.go b/cmd/volumes.go
index 92b588b..6df1b69 100644
--- a/cmd/volumes.go
+++ b/cmd/volumes.go
@@ -23,6 +23,7 @@ import (
"fmt"
"strings"
"github.com/MikunoNaka/macli/ui"
+ "github.com/MikunoNaka/macli/util"
"github.com/MikunoNaka/macli/mal"
m "github.com/MikunoNaka/MAL2Go/v4/manga"
@@ -41,7 +42,17 @@ var volumesCmd = &cobra.Command{
" - \x1b[33m`macli volumes -s +1 <manga-name>`\x1b[0m to increment the volumes by 1\n" +
" - \x1b[33m`macli volumes -s -2 <manga-name>`\x1b[0m to decrement the volumes by 2\n",
Run: func(cmd *cobra.Command, args []string) {
+ conf, err := util.BindSearchConfig(cmd.Flags())
+ if err != nil {
+ fmt.Println("Error while parsing flags.", err.Error())
+ os.Exit(1)
+ }
+ mal.SearchLength = conf.SearchLength
+ mal.SearchOffset = conf.SearchOffset
+ mal.SearchNSFW = conf.SearchNSFW
+ ui.PromptLength = conf.PromptLength
mal.Init()
+
var selectedManga m.Manga
if entryId > 0 {
selectedManga = mal.GetMangaData(entryId, []string{"my_list_status", "num_volumes"})
@@ -58,10 +69,7 @@ var volumesCmd = &cobra.Command{
searchInput = ui.TextInput(promptText, "Search can't be blank.")
}
- var (
- volInput string
- err error
- )
+ var volInput string
if !queryOnlyMode {
volInput, err = cmd.Flags().GetString("set-value")
if err != nil {
@@ -92,11 +100,12 @@ var volumesCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(volumesCmd)
volumesCmd.Flags().StringP("set-value", "s", "", "Number of voulmes")
- volumesCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", 5, "Length of select prompt")
- volumesCmd.Flags().IntVarP(&mal.SearchLength, "search-length", "n", 10, "Amount of search results to load")
- volumesCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", 0, "Offset for the search results")
- volumesCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
volumesCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
volumesCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of manga (overrides search)")
volumesCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
+
+ volumesCmd.Flags().IntP("prompt-length", "l", 5, "Length of select prompt")
+ volumesCmd.Flags().IntP("search-length", "n", 10, "Amount of search results to load")
+ volumesCmd.Flags().IntP("search-offset", "o", 0, "Offset for the search results")
+ volumesCmd.Flags().BoolP("search-nsfw", "", false, "Include NSFW-rated items in search results")
}