cli/meter: rename delay to interval

This commit is contained in:
andig 2025-03-31 18:56:09 +02:00
parent 9eb5e33652
commit a44758a4c8
2 changed files with 6 additions and 6 deletions

View file

@ -54,10 +54,10 @@ const (
flagStop = "stop"
flagStopDescription = "Stop charging"
flagRepeat = "repeat"
flagRepeatDescription = "Repeat until interrupted"
flagRepeatDelay = "repeat-delay"
flagRepeatDelayDescription = "Delay between repeats"
flagRepeat = "repeat"
flagRepeatDescription = "Repeat until interrupted"
flagRepeatInterval = "repeat-interval"
flagRepeatIntervalDescription = "Interval between repetitions"
flagDigits = "digits"
flagDelay = "delay"

View file

@ -21,7 +21,7 @@ func init() {
meterCmd.Flags().StringP(flagBatteryMode, "b", "", flagBatteryModeDescription)
meterCmd.Flags().DurationP(flagBatteryModeWait, "w", 0, flagBatteryModeWaitDescription)
meterCmd.Flags().BoolP(flagRepeat, "r", false, flagRepeatDescription)
meterCmd.Flags().Duration(flagRepeatDelay, 0, flagRepeatDelayDescription)
meterCmd.Flags().Duration(flagRepeatInterval, 0, flagRepeatIntervalDescription)
}
func runMeter(cmd *cobra.Command, args []string) {
@ -77,7 +77,7 @@ func runMeter(cmd *cobra.Command, args []string) {
d.DumpWithHeader(dev.Config().Name, v)
}
if ok, _ := cmd.Flags().GetBool(flagRepeat); ok {
if d, err := cmd.Flags().GetDuration(flagRepeatDelay); d > 0 && err == nil {
if d, err := cmd.Flags().GetDuration(flagRepeatInterval); d > 0 && err == nil {
log.INFO.Println("waiting for:", d)
time.Sleep(d)
}