commit | 20b4e870c2524efc8fad48b84b59217fb3eb4b1f | [log] [tgz] |
---|---|---|
author | Ash Wilson <smashwilson@gmail.com> | Wed Oct 22 17:39:21 2014 -0400 |
committer | Ash Wilson <smashwilson@gmail.com> | Wed Oct 22 17:39:21 2014 -0400 |
tree | 640b79849a21d3eee1a90f77f5c675dcfff8d645 | |
parent | 0b96c611c2983ea3059a5dd7547044d51e580d9e [diff] |
Handy utility function.
diff --git a/acceptance/tools/tools.go b/acceptance/tools/tools.go index b3f3ea7..61b1d7a 100644 --- a/acceptance/tools/tools.go +++ b/acceptance/tools/tools.go
@@ -71,3 +71,12 @@ } return prefix + string(bytes) } + +// Elide returns the first bit of its input string with a suffix of "..." if it's longer than +// a comfortable 40 characters. +func Elide(value string) string { + if len(value) > 40 { + return value[0:37] + "..." + } + return value +}