summaryrefslogtreecommitdiff
path: root/internal/version/version.go
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2022-02-04 21:37:29 +0000
committerPaul Buetow <pbuetow@mimecast.com>2022-02-04 21:37:29 +0000
commit1db3b5dc1219e34e0e1c612e6646327701c40274 (patch)
treecab22128af9e54131facd0062a474459383a1c90 /internal/version/version.go
parent6625d019271d3d7931587167845d77834d187d57 (diff)
parentcc6f19f69d0fb34af96e17147b2030c352d46845 (diff)
merge 4.0.0-RC
Diffstat (limited to 'internal/version/version.go')
-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 309e02f..18c3b88 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.3.2"
+ Version string = "4.0.0"
// 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)
}