diff --git a/cmd/city.go b/cmd/city.go deleted file mode 100644 index 859018e..0000000 --- a/cmd/city.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright © 2024 NAME HERE - -*/ -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// cityCmd represents the city command -var cityCmd = &cobra.Command{ - Use: "city", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("city called") - }, -} - -func init() { - searchCmd.AddCommand(cityCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // cityCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // cityCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/add.go b/cmd/fav.go similarity index 74% rename from cmd/add.go rename to cmd/fav.go index 297a546..0f8c89a 100644 --- a/cmd/add.go +++ b/cmd/fav.go @@ -10,9 +10,9 @@ import ( "github.com/spf13/cobra" ) -// addCmd represents the add command -var addCmd = &cobra.Command{ - Use: "add", +// favCmd represents the fav command +var favCmd = &cobra.Command{ + Use: "fav", Short: "A brief description of your command", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: @@ -21,20 +21,20 @@ Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println("add called") + fmt.Println("fav called") }, } func init() { - rootCmd.AddCommand(addCmd) + rootCmd.AddCommand(favCmd) // Here you will define your flags and configuration settings. // Cobra supports Persistent Flags which will work for this command // and all subcommands, e.g.: - // addCmd.PersistentFlags().String("foo", "", "A help for foo") + // favCmd.PersistentFlags().String("foo", "", "A help for foo") // Cobra supports local flags which will only run when this command // is called directly, e.g.: - // addCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + // favCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } diff --git a/cmd/get.go b/cmd/get.go deleted file mode 100644 index 588dd1b..0000000 --- a/cmd/get.go +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright © 2024 NAME HERE -*/ -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// getCmd represents the get command -var getCmd = &cobra.Command{ - Use: "get", - Short: "Displays your favorite Mensa meal plans.", - Long: `.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("get called") - }, -} - -func init() { - rootCmd.AddCommand(getCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // getCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // getCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/mensa.go b/cmd/mensa.go deleted file mode 100644 index b0d2c19..0000000 --- a/cmd/mensa.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright © 2024 NAME HERE -*/ -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// mensaCmd represents the mensa command -var mensaCmd = &cobra.Command{ - Use: "mensa", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("mensa called") - }, -} - -func init() { - searchCmd.AddCommand(mensaCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // mensaCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // mensaCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/root.go b/cmd/root.go index 8818415..1abdeb7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -43,6 +43,9 @@ func init() { // Cobra also supports local flags, which will only run // when this action is called directly. rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + + // Disable the default help command + rootCmd.CompletionOptions.DisableDefaultCmd = true } func initConfig() { diff --git a/cmd/search.go b/cmd/search.go index 3093d18..2c08e68 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -17,13 +17,10 @@ import ( // searchCmd represents the search command var searchCmd = &cobra.Command{ Use: "search", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: + Short: "Gets a Mensa to display or add it to your favorites", + Long: `This command will prompt you to select a state, city and mensa. + You can then choose to display the menu or save the mensa to your favorites.`, -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, Run: func(cmd *cobra.Command, args []string) { prompt := promptui.Select{ Label: "Select Day", @@ -92,8 +89,6 @@ to quickly create a Cobra application.`, return } - fmt.Printf("You choose %q\n", result) - if result == "menu" { data, err := internal.GetMenu(selectedCity, selectedMensa) if err != nil {