refactor: implement most of ps plugin in golang

This commit is contained in:
Jose Diaz-Gonzalez
2020-11-01 15:53:53 -05:00
parent c72bbf41ea
commit e7ee7a1781
48 changed files with 1227 additions and 676 deletions

View File

@@ -9,6 +9,7 @@ import (
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"unicode"
@@ -379,6 +380,16 @@ func ToBool(s string) bool {
return s == "true"
}
// ToInt returns an int value for a given string
func ToInt(s string, defaultValue int) int {
i, err := strconv.Atoi(s)
if err != nil {
return defaultValue
}
return i
}
// UcFirst uppercases the first character in a string
func UcFirst(str string) string {
for i, v := range str {