Add about and version

This commit is contained in:
2023-05-09 21:40:48 +02:00
parent f8649e0444
commit 32ee7a355c

View File

@@ -16,6 +16,8 @@ const (
Prompt = "otter> " Prompt = "otter> "
OtterHistory = ".otterhistory" OtterHistory = ".otterhistory"
OtterRC = ".otterrc" OtterRC = ".otterrc"
NAME = "minify_tf"
VERSION = "v0.0.1"
) )
func executeCommand(cmd string, args []string) { func executeCommand(cmd string, args []string) {
@@ -36,6 +38,21 @@ func executeCommand(cmd string, args []string) {
} }
sourceFile(args[0]) sourceFile(args[0])
case "about":
nv := NAME + " " + VERSION
nvLen := len(nv)
spacesLen := 26 - nvLen
for i := 0; i < spacesLen; i++ {
nv += " "
}
fmt.Println("+----------------------------+")
fmt.Println("| " + nv + "|")
fmt.Println("| by @k3y0708 |")
fmt.Println("| https://github.com/k3y0708 |")
fmt.Println("+----------------------------+")
case "version":
fmt.Println(VERSION)
default: default:
//Check if command is a file //Check if command is a file
cmd, err := findCommand(cmd) cmd, err := findCommand(cmd)