added stuff idfk what to call this

This commit is contained in:
echo 2022-09-07 19:58:27 +04:30
parent f0805c1292
commit 2eb1ba09e8

59
main.go
View file

@ -2,12 +2,22 @@ package main
import (
"fmt"
"strings"
"os"
"os/exec"
"cpu"
"strconv"
"strings"
)
func getHostname() string {
cmd := exec.Command("uname", "-n")
shell, _ := cmd.Output()
return strings.Replace(string(shell), "\n", "", -1)
}
func getUsername() string {
cmd := exec.Command("whoami")
shell, _ := cmd.Output()
return strings.Replace(string(shell), "\n", "", -1)
}
func getLogo() {
}
func getDistro() string {
@ -31,32 +41,25 @@ func getDistro() string{
}
return strings.Trim(distro_tuples["PRETTY_NAME"], "\"")
}
func getHost() {
}
func getKernel() string {
cmd := exec.Command("uname", "-r")
kernel, err := cmd.Output()
if err != nil {
fmt.Println(err.Error())
return
return "fuck you"
}
return string(kernel)
}
func getUptime() {
}
func getPackages() {
}
func getShell() string {
cmd := exec.Command("echo","$SHELL")
shell, err := cmd.Output()
if err != nil {
fmt.Println(err.Error())
return
}
return string(shell)
return os.Getenv("SHELL")
}
func getResolution() {
}
func getWM() {
}
@ -68,9 +71,21 @@ func getTerminal() {
}
func getCPU() {
}
func getGPU() {
func getGPU() string {
cmd := exec.Command("lspci", "-v")
shell, err := cmd.Output()
_ = err
var bruh string
//return strings.Replace(string(shell), "\n", "", -1)
//return string(shell)
for _, line := range strings.Split(strings.TrimSuffix(string(shell), "\n"), "\n") {
if strings.Contains(line, "VGA") {
bruh += line[strings.Index(line, ": ")+2 : strings.Index(line, " (")]
}
func getMemory() {
}
return bruh
}
func getMemory() string {
//
// The coolest part about this function unlike neofetch is that it also takes account of the basic os operations
@ -86,7 +101,7 @@ func getMemory() {
mem_info := make([]byte, 1024)
mem.Read(mem_info)
mem.Close()
mem_list := strings.Split(string(mem_info),"\n");
mem_list := strings.Split(string(mem_info), "\n")
mem_map := make(map[string]string)
for _, v := range mem_list {
if strings.Contains(v, ":") {
@ -102,14 +117,18 @@ func getMemory() {
mem_total, _ := strconv.Atoi(mem_map["MemTotal"])
mem_used := mem_total - mem_free
memory := fmt.Sprintf("%d/%d", mem_used/1024, mem_total/1024)
return memory
return (memory)
}
func getColorPalette() {
}
func main() {
/*just for testing, dont use these lmao im gonna make an config file
fmt.Println(getHostname(), "@", getUsername())
fmt.Println(getDistro())
fmt.Println(getGPU())
fmt.Println(getMemory())
fmt.Println(getKernel())
*/
}