Skip to content

Commit

Permalink
Update help message
Browse files Browse the repository at this point in the history
  • Loading branch information
msharris committed Mar 15, 2024
1 parent 6da6c18 commit ecfbb27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ func (f *Field) Set(s string) error {
switch s {
case "id", "name", "index", "time", "status":
*f = Field(s)
case "location":
*f = Name
case "uv":
*f = UVIndex
case "date":
*f = Time
default:
return errors.New(`must be one of "id", "name", "index", "uv", "time", "date", "status"`)
return errors.New(`must be one of "id", "name", "location", index", "uv", "time", "date", "status"`)
}
return nil
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
var rootCmd = &cobra.Command{
Use: "uv",
Short: "Shows the current UV index for various locations around Australia",
Long: `uv is an app that shows the current UV index for various locations around Australia.
UV observations are sourced from the ARPANSA API.`,
Long: `Shows the current UV index for various locations around Australia.
Observations are sourced from ARPANSA.
See disclaimer: https://www.arpansa.gov.au/our-services/monitoring/ultraviolet-radiation-monitoring/ultraviolet-radation-data-information#Disclaimer`,
RunE: func(cmd *cobra.Command, args []string) error {
return app.Run(flags)
},
Expand All @@ -28,7 +29,7 @@ func Execute() {
var flags = app.Options{Sort: app.Name}

func init() {
rootCmd.Flags().StringSliceVarP(&flags.Locations, "locations", "l", nil, "a comma-separated list of locations to display")
rootCmd.Flags().VarP(&flags.Sort, "sort", "s", "field to sort the observations by")
rootCmd.Flags().BoolVarP(&flags.Reverse, "reverse", "r", false, "print the observations in reverse order")
rootCmd.Flags().StringSliceVarP(&flags.Locations, "locations", "l", nil, "comma-separated list of locations to display (accepts id and name)")
rootCmd.Flags().VarP(&flags.Sort, "sort", "s", "field to sort observations by")
rootCmd.Flags().BoolVarP(&flags.Reverse, "reverse", "r", false, "print observations in reverse order")
}

0 comments on commit ecfbb27

Please sign in to comment.