diff --git a/cmd/root.go b/cmd/root.go index 05c5819..56c87ce 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,7 +1,7 @@ /* -Copyright © 2024 NAME HERE - +Copyright © 2024 raul */ + package cmd import ( @@ -10,25 +10,14 @@ import ( "github.com/spf13/cobra" ) - - -// rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "aemet", - Short: "A brief description of your application", - Long: `A longer description that spans multiple lines and likely contains -examples and usage of using your application. 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.`, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, + Short: "API Server that fetches spanish weather data from the AEMET", + Long: `API Server that fetches spanish weather data from the AEMET formatted +in XML and translates it to JSON, optionally allowing to render the +obtained data in a web page.`, } -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { err := rootCmd.Execute() if err != nil { @@ -37,15 +26,5 @@ func Execute() { } func init() { - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. - - // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.aemet.yaml)") - - // 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") } - - diff --git a/cmd/server.go b/cmd/server.go index 0c7ab27..c1a500a 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -11,13 +11,8 @@ import ( var serverCmd = &cobra.Command{ Use: "server", - 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.`, + Short: "Start aemet webserver", + Long: `Start aemet webserver`, Run: func(cmd *cobra.Command, args []string) { if err := setServerParameters(cmd); err != nil { log.Fatalf("Error happened trying to set parameters: %v\n", err) @@ -28,7 +23,7 @@ to quickly create a Cobra application.`, func init() { rootCmd.AddCommand(serverCmd) - serverCmd.PersistentFlags().StringP("port", "p", "1302", "port to use for listening") + serverCmd.PersistentFlags().StringP("port", "p", "1302", "Port to use for listening") } func setServerParameters(cmd *cobra.Command) error {