Merge branch 'master' into view-the-current-state
This commit is contained in:
commit
7ceffd0827
14 changed files with 594 additions and 194 deletions
|
|
@ -2,6 +2,7 @@ package utils
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/briandowns/spinner"
|
||||
|
|
@ -54,6 +55,19 @@ func FuzzyAgo(ago time.Duration) string {
|
|||
return fmtDuration(int(ago.Hours()/24/365), "year")
|
||||
}
|
||||
|
||||
func Humanize(s string) string {
|
||||
// Replaces - and _ with spaces.
|
||||
replace := "_-"
|
||||
h := func(r rune) rune {
|
||||
if strings.ContainsRune(replace, r) {
|
||||
return ' '
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
return strings.Map(h, s)
|
||||
}
|
||||
|
||||
func Spinner() *spinner.Spinner {
|
||||
return spinner.New(spinner.CharSets[11], 400*time.Millisecond)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue