MCPcopy Index your code
hub / github.com/coder/coder / parseDuration

Function parseDuration

cli/util.go:167–177  ·  view source on GitHub ↗

parseDuration parses a duration from a string. If units are omitted, minutes are assumed.

(raw string)

Source from the content-addressed store, hash-verified

165// parseDuration parses a duration from a string.
166// If units are omitted, minutes are assumed.
167func parseDuration(raw string) (time.Duration, error) {
168 // If the user input a raw number, assume minutes
169 if isDigit(raw) {
170 raw += "m"
171 }
172 d, err := time.ParseDuration(raw)
173 if err != nil {
174 return 0, err
175 }
176 return d, nil
177}
178
179func isDigit(s string) bool {
180 return strings.IndexFunc(s, func(c rune) bool {

Callers 2

scheduleStopMethod · 0.85
scheduleExtendMethod · 0.85

Calls 1

isDigitFunction · 0.85

Tested by

no test coverage detected