2024-09-29 17:20:59 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2024-10-02 13:47:49 +00:00
|
|
|
"git.sr.ht/~timharek/yr-go/cmd/flags"
|
2024-09-29 17:20:59 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var rootCmd = &cobra.Command{
|
|
|
|
Use: "yr",
|
|
|
|
Short: "Get the weather for your desired location.",
|
|
|
|
Long: `Get the weather for your desired location.`,
|
|
|
|
}
|
|
|
|
|
|
|
|
func Execute() {
|
|
|
|
err := rootCmd.Execute()
|
|
|
|
if err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2024-10-02 13:47:49 +00:00
|
|
|
rootCmd.PersistentFlags().Bool(flags.JSON, false, "Result in JSON")
|
|
|
|
rootCmd.PersistentFlags().Float64P(flags.LON, "x", 0, "Longitude coordinate")
|
|
|
|
rootCmd.PersistentFlags().Float64P(flags.LAT, "y", 0, "Latitude coordinate")
|
2024-09-29 17:20:59 +00:00
|
|
|
}
|