summaryrefslogtreecommitdiffstats
path: root/pkg/utils
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-13 20:26:02 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-13 20:26:02 +1000
commit97cff656121270e9c790432e28622d92ab7b0f1a (patch)
tree7425013e94dc0a19699b48bde6bb20c6f5b86c8a /pkg/utils
parentf9c39ad64bddd1577636c0ce5606eda44bc704ef (diff)
progress on refactor
Diffstat (limited to 'pkg/utils')
-rw-r--r--pkg/utils/utils.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index 6b91ed6ef..b3efcc2db 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -54,3 +54,12 @@ func GetCurrentProject() string {
}
return filepath.Base(pwd)
}
+
+// TrimTrailingNewline - Trims the trailing newline
+// TODO: replace with `chomp` after refactor
+func TrimTrailingNewline(str string) string {
+ if strings.HasSuffix(str, "\n") {
+ return str[:len(str)-1]
+ }
+ return str
+}