String returns the RefreshInterval as a string that can be used as an xbar interval, as represented in plugin filenames.
()
| 47 | // String returns the RefreshInterval as a string that can be used as an xbar |
| 48 | // interval, as represented in plugin filenames. |
| 49 | func (r RefreshInterval) String() string { |
| 50 | switch r.Unit { |
| 51 | case "days": |
| 52 | return fmt.Sprintf("%dd", r.N) |
| 53 | case "hours": |
| 54 | return fmt.Sprintf("%dh", r.N) |
| 55 | case "minutes": |
| 56 | return fmt.Sprintf("%dm", r.N) |
| 57 | case "seconds": |
| 58 | return fmt.Sprintf("%ds", r.N) |
| 59 | case "milliseconds": |
| 60 | return fmt.Sprintf("%dms", r.N) |
| 61 | default: |
| 62 | return "<invalid>" |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // SetRefreshInterval sets the time interval at which a plugin should be re-run. |
| 67 | func SetRefreshInterval(pluginDirectory, installedPluginPath string, refreshInterval RefreshInterval) (string, RefreshInterval, error) { |
no outgoing calls