Skip to content

Commit

Permalink
ksctl version
Browse files Browse the repository at this point in the history
easteregg added

Signed-off-by: Dipankar Das <65275144+dipankardas011@users.noreply.github.com>
dipankardas011 committed Jun 24, 2024
1 parent 0b15d41 commit 0bd6aa8
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
@@ -2,11 +2,14 @@ package cmd

import (
"fmt"
"strings"

"github.com/fatih/color"
"github.com/spf13/cobra"
)

const ksctl = `
const (
v0_1Ksctl = `
_ _ _
| | | | | |
| | _____ ___| |_| |
@@ -16,6 +19,24 @@ const ksctl = `
`

v1_0Ksctl = `
__ __ .__
| | __ ______ ____ _/ |_ | |
| |/ / / ___/_/ ___\\ __\| |
| < \___ \ \ \___ | | | |__
|__|_ \/____ > \___ >|__| |____/
\/ \/ \/
`

v2_0Ksctl = `
░ ░░░░ ░░░ ░░░░ ░░░ ░░ ░░░░░░░
▒ ▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒
▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓▓
▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓▓
█ ████ ███ ████ ██████ █████ █
`
)

// change this using ldflags
var Version string = "dev"

@@ -26,7 +47,34 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of ksctl",
Run: func(cmd *cobra.Command, args []string) {
fmt.Print(ksctl)

fmt.Println(v0_1Ksctl)

color.HiGreen(v1_0Ksctl)

x := strings.Split(v2_0Ksctl, "\n")

y := []string{}

colorCode := map[int]func(str string) string{
0: func(str string) string { return color.HiMagentaString(str) },
1: func(str string) string { return color.HiBlueString(str) },
2: func(str string) string { return color.HiCyanString(str) },
3: func(str string) string { return color.HiGreenString(str) },
4: func(str string) string { return color.HiYellowString(str) },
5: func(str string) string { return color.HiRedString(str) },
}

for i, _x := range x {
fmt.Println(i, _x)
if _y, ok := colorCode[i]; ok {
y = append(y, _y(_x))
} else {
fmt.Println("Not found", i)
}
}
fmt.Println(strings.Join(y, "\n"))

fmt.Println("Version:", Version)
fmt.Println("BuildDate:", BuildDate)
},

0 comments on commit 0bd6aa8

Please sign in to comment.