-progress cli param for bars
This commit is contained in:
13
pkg/helper/string.go
Normal file
13
pkg/helper/string.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package helper
|
||||
|
||||
// ShortenStringLeft shortens a string
|
||||
func ShortenStringLeft(str string, num int) string {
|
||||
tstr := str
|
||||
if len(str) > num {
|
||||
if num > 3 {
|
||||
num -= 3
|
||||
}
|
||||
tstr = "..." + str[len(str)-num:len(str)]
|
||||
}
|
||||
return tstr
|
||||
}
|
||||
Reference in New Issue
Block a user