MCPcopy Create free account
hub / github.com/diillson/chatcli / humanDuration

Function humanDuration

cli/config_sections.go:293–306  ·  view source on GitHub ↗

humanDuration formats a duration as "2h 34m" / "12m 3s" / "45s". Non-translated: the h/m/s suffixes are language-neutral shorthand.

(d time.Duration)

Source from the content-addressed store, hash-verified

291// humanDuration formats a duration as "2h 34m" / "12m 3s" / "45s".
292// Non-translated: the h/m/s suffixes are language-neutral shorthand.
293func humanDuration(d time.Duration) string {
294 d = d.Truncate(time.Second)
295 if d < time.Minute {
296 return fmt.Sprintf("%ds", int(d.Seconds()))
297 }
298 if d < time.Hour {
299 m := int(d.Minutes())
300 s := int(d.Seconds()) - m*60
301 return fmt.Sprintf("%dm %ds", m, s)
302 }
303 h := int(d.Hours())
304 m := int(d.Minutes()) - h*60
305 return fmt.Sprintf("%dh %dm", h, m)
306}
307
308// subheader prints a "── <label>" subsection divider in gray.
309func subheader(prefix, labelKey string) {

Callers 3

showConfigPanoramaMethod · 0.85
showConfigSessionMethod · 0.85
showConfigAuthMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected