aboutsummaryrefslogtreecommitdiff
path: root/cmd/seasonals.go
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/seasonals.go
parent37b5c5457d51b50af1dcadaf7c85be7e7349d682 (diff)
reading both flags and config for searching commands
Diffstat (limited to 'cmd/seasonals.go')
-rw-r--r--cmd/seasonals.go7
1 files changed, 6 insertions, 1 deletions
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"))
}