MCPcopy
hub / github.com/matryer/xbar / validateRefreshInterval

Function validateRefreshInterval

pkg/plugins/refresh_interval.go:99–109  ·  view source on GitHub ↗
(refreshInterval RefreshInterval)

Source from the content-addressed store, hash-verified

97}
98
99func validateRefreshInterval(refreshInterval RefreshInterval) error {
100 if n := refreshInterval.N; n < 1 {
101 return errors.Errorf("bad interval value: %d", n)
102 }
103 for _, unit := range []string{"days", "hours", "minutes", "seconds", "milliseconds"} {
104 if refreshInterval.Unit == unit {
105 return nil
106 }
107 }
108 return errors.Errorf("bad interval unit: %s", refreshInterval.Unit)
109}
110
111// ParseFilenameInterval parses the filename to extract the refresh interval
112// or returns a default if it is do so.

Callers 2

SetRefreshIntervalFunction · 0.85

Calls

no outgoing calls

Tested by 1