From 6ac3bd9b1cc4b9c897e8e9623313924b80f6a4b2 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 3 Jul 2022 22:56:00 +0530 Subject: added flags to modify prompt length and search results length --- cmd/search.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/search.go b/cmd/search.go index 969af8f..391919e 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -38,7 +38,7 @@ var searchCmd = &cobra.Command { "\t\x1b[33m`macli search -m `\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) { - mal.Init() + mal.Init() // read searchInput from command searchInput := strings.Join(args, " ") mangaMode, err := cmd.Flags().GetBool("manga") @@ -77,4 +77,9 @@ func searchAnime(searchInput string) { func init() { rootCmd.AddCommand(searchCmd) + searchCmd.PersistentFlags().IntVarP(&ui.PromptLength, "prompt-length", "l", 5, "Length of select prompt") + searchCmd.PersistentFlags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode") + searchCmd.PersistentFlags().IntVarP(&mal.SearchLength, "search-length", "n", 10, "Amount of search results to load") + searchCmd.PersistentFlags().IntVarP(&mal.SearchOffset, "search-offset", "o", 0, "Offset for the search results") + searchCmd.PersistentFlags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)") } -- cgit v1.2.3