aboutsummaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-05-17 03:49:02 +0700
committerShulhan <ms@kilabit.info>2018-05-17 03:49:02 +0700
commitfb989eced7d80da08973f04a561464f54a5f08d8 (patch)
treefacb34dcb0c54829f54317314502ccd8369aca4a /common.go
parentf089e57911b102c3ef94184a8ef32f457b940eb4 (diff)
downloadbeku-fb989eced7d80da08973f04a561464f54a5f08d8.tar.xz
Move Package.IsTag to common.IsTagVersion and add unit test for it
Diffstat (limited to 'common.go')
-rw-r--r--common.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/common.go b/common.go
index 916b950..f15e7b9 100644
--- a/common.go
+++ b/common.go
@@ -32,6 +32,24 @@ func IsIgnoredDir(name string) bool {
}
//
+// IsTagVersion return true if "version" prefixed with "v" or contains at
+// least one dot "." character.
+//
+func IsTagVersion(version string) bool {
+ version = strings.TrimSpace(version)
+ if len(version) == 0 {
+ return false
+ }
+ if version[0] == prefixTag && len(version) > 1 {
+ return true
+ }
+ if strings.IndexByte(version, sepVersion) > 0 {
+ return true
+ }
+ return false
+}
+
+//
// confirm display a question to standard output and read for answer
// from "in" for simple "y" or "n" answer.
// If "in" is nil, it will set to standard input.