aboutsummaryrefslogtreecommitdiff
path: root/cmd/seasonals.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-17 20:59:13 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-07-17 20:59:13 +0530
commite82ed01a85e6dbaa838b8ee18b44f4d80a81390b (patch)
tree0a203e5563de8441d02cf9fb688e86daf93e67d5 /cmd/seasonals.go
parente8a8348c144fe79d99bb1e486e745456baea1d08 (diff)
added flags for year, season and sort
Diffstat (limited to 'cmd/seasonals.go')
-rw-r--r--cmd/seasonals.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/seasonals.go b/cmd/seasonals.go
index 1e3eb20..7169488 100644
--- a/cmd/seasonals.go
+++ b/cmd/seasonals.go
@@ -39,9 +39,16 @@ var seasonalsCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
mal.Init()
- currentSeason := util.GetCurrentSeason()
+ season := util.GetCurrentSeason()
- res := mal.GetSeasonalAnime(currentSeason, "anime_score")
+ sort, _ := cmd.Flags().GetString("sort")
+ seasonInput, _ := cmd.Flags().GetString("season")
+ yearInput, _ := cmd.Flags().GetInt("year")
+
+ if seasonInput != "" {season.Name = seasonInput}
+ if yearInput > 0 {season.Year = yearInput}
+
+ res := mal.GetSeasonalAnime(season, sort)
for _, i := range res {
fmt.Println(i.Title)
}
@@ -57,4 +64,8 @@ func init() {
seasonalsCmd.Flags().IntVarP(&mal.SearchLength, "results-length", "n", 10, "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, "")
}