From 275c50f0e91444ed7341909acab7e7c5ef3afc2a Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Thu, 20 Oct 2022 09:49:21 +0330 Subject: [PATCH] added kernel name command --- data/data.go | 4 ++-- main.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/data/data.go b/data/data.go index a1c9699..605ad9c 100644 --- a/data/data.go +++ b/data/data.go @@ -45,8 +45,8 @@ func GetKernel() string { return string(kernel) } -func GetHostname() string { - cmd := exec.Command("uname", "-n") +func Unamebs(gamering string) string { + cmd := exec.Command("uname", gamering) shell, _ := cmd.Output() return strings.Replace(string(shell), "\n", "", -1) } diff --git a/main.go b/main.go index 3d54f5b..0e22c54 100644 --- a/main.go +++ b/main.go @@ -65,7 +65,9 @@ func handlePrint(action, format string, rest string) { no, _ := strconv.Atoi(data.GetUptime()) utils.CutePrint(data.FormatTime(no), format) case "hostname": - utils.CutePrint(data.GetHostname(), format) + utils.CutePrint(data.Unamebs("-n"), format) + case "kernelname": + utils.CutePrint(data.Unamebs("-s"), format) case "GPU": utils.CutePrint(data.GetGPU(), format) case "shell":