From 769102da79262f52ab99bf77d4bc286609ee3aa2 Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Thu, 15 Dec 2022 02:18:42 +0330 Subject: [PATCH] what have i created --- constants/constants.go | 2 ++ main.go | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/constants/constants.go b/constants/constants.go index 8b8cbd5..fabbf85 100644 --- a/constants/constants.go +++ b/constants/constants.go @@ -2,6 +2,8 @@ package constants const Defaultcolor = "red 255 38 116 \ngreen 16 210 117\nblue 104 174 212\nwhite 250 253 255" +//DO NOT YELL AT ME THAT THIS ISNT A CONST YOU CANT MAKE A CONST YOU FUCKER + var Color_map = map[string]string{ "black": "30", "red": "31", diff --git a/main.go b/main.go index ed89c9f..dd46626 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "io/ioutil" "os" + "os/exec" "path/filepath" "strconv" "strings" @@ -19,6 +20,16 @@ func checkforconfigfolder() { os.Mkdir(data.GetHome()+"/.config", os.ModePerm) } } +func getSubstring(s string, indices []int) string { + return string(s[indices[0]:indices[1]]) +} + +func parseshell(bruh string) string { + // https://www.youtube.com/watch?v=YPN0qhSyWy8 + cmd := bruh + " --version | grep -o -E \"([0-9]\\.?)*\" | head -n1" + out, _ := exec.Command("bash", "-c", cmd).Output() + return bruh + " " + strings.ReplaceAll(string(out), "\n", "") +} func handleConfig() { _, folder := os.Stat(filepath.Dir(data.GetConfigFile())) @@ -75,7 +86,7 @@ func handlePrint(action, format string, rest string) { case "GPU": utils.CutePrint(data.GetGPU(), format) case "shell": - utils.CutePrint(data.GetShell(), format) + utils.CutePrint(parseshell(data.GetShell()), format) case "terminal": utils.CutePrint(data.GetTerminal(), format) case "memoryAll":