From d67758bdbeb162adadb6b19954e8e22cf04ed388 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 30 Sep 2022 15:10:58 +0530 Subject: reading both flags and config for searching commands --- cmd/seasonals.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/seasonals.go') 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")) } -- cgit v1.2.3