summaryrefslogtreecommitdiff
path: root/internal/version
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2021-10-15 12:38:39 +0300
committerPaul Buetow <pbuetow@mimecast.com>2021-10-15 12:38:39 +0300
commit55ba72efa4e5d2363f8e0c2cf729c596e760e1c3 (patch)
tree72618e384626d9fc368994e3f24be9e9892d0610 /internal/version
parentdccbee7dc355438d87baff45e054848e508b004d (diff)
parentd3549a3316a9917520ab5e6b0cd7b1846c59ad4b (diff)
merge from github.com/snonux/dtail
Diffstat (limited to 'internal/version')
-rw-r--r--internal/version/version.go34
1 files changed, 23 insertions, 11 deletions
diff --git a/internal/version/version.go b/internal/version/version.go
index b513b40..68b9e6e 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -5,38 +5,50 @@ import (
"os"
"github.com/mimecast/dtail/internal/color"
+ "github.com/mimecast/dtail/internal/config"
+ "github.com/mimecast/dtail/internal/protocol"
)
const (
// Name of DTail.
Name string = "DTail"
// Version of DTail.
- Version string = "3.1.0"
+ Version string = "4.0.0-RC1"
// Additional information for DTail
- Additional string = ""
- // ProtocolCompat -ibility version.
- ProtocolCompat string = "3"
+ Additional string = "Have a lot of fun!"
)
// String representation of the DTail version.
func String() string {
- return fmt.Sprintf("%s %v Protocol %s %s", Name, Version, ProtocolCompat, Additional)
+ return fmt.Sprintf("%s %v Protocol %s %s", Name, Version,
+ protocol.ProtocolCompat, Additional)
}
// PaintedString is a prettier string representation of the DTail version.
func PaintedString() string {
- if !color.Colored {
+ if !config.Client.TermColorsEnable {
return String()
}
- name := color.Paint(color.Yellow, Name)
- version := color.Paint(color.Blue, Version)
- descr := color.Paint(color.Green, Additional)
- return fmt.Sprintf("%s %v Protocol %s %s", name, version, ProtocolCompat, descr)
+ name := color.PaintStrWithAttr(fmt.Sprintf(" %s ", Name),
+ color.FgYellow, color.BgBlue, color.AttrBold)
+ version := color.PaintStrWithAttr(fmt.Sprintf(" %s ", Version),
+ color.FgBlue, color.BgYellow, color.AttrBold)
+ protocol := color.PaintStr(fmt.Sprintf(" Protocol %s ", protocol.ProtocolCompat),
+ color.FgBlack, color.BgGreen)
+ additional := color.PaintStrWithAttr(fmt.Sprintf(" %s ", Additional),
+ color.FgWhite, color.BgMagenta, color.AttrUnderline)
+
+ return fmt.Sprintf("%s%v%s%s", name, version, protocol, additional)
+}
+
+// Print the version.
+func Print() {
+ fmt.Println(PaintedString())
}
// PrintAndExit prints the program version and exists.
func PrintAndExit() {
- fmt.Println(PaintedString())
+ Print()
os.Exit(0)
}