diff options
| author | Shulhan <ms@kilabit.info> | 2018-05-17 03:49:02 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-05-17 03:49:02 +0700 |
| commit | fb989eced7d80da08973f04a561464f54a5f08d8 (patch) | |
| tree | facb34dcb0c54829f54317314502ccd8369aca4a /common.go | |
| parent | f089e57911b102c3ef94184a8ef32f457b940eb4 (diff) | |
| download | beku-fb989eced7d80da08973f04a561464f54a5f08d8.tar.xz | |
Move Package.IsTag to common.IsTagVersion and add unit test for it
Diffstat (limited to 'common.go')
| -rw-r--r-- | common.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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. |
