wow --help my beloved is here

This commit is contained in:
echo 2022-12-25 09:37:48 +03:30
parent c83c02f4f1
commit 812d977fcc
4 changed files with 22 additions and 7 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
main

View file

@ -27,7 +27,6 @@ func GetLocalIP() string {
return ""
}
for _, address := range addrs {
// check the address type and if it is not a loopback the display it
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
return ipnet.IP.String()

22
main.go
View file

@ -20,15 +20,12 @@ func checkforconfigfolder() {
os.Mkdir(data.GetHome()+"/.config", os.ModePerm)
}
}
func getSubstring(s string, indices []int) string {
return string(s[indices[0]:indices[1]])
}
func getShellVersion(shellCommand string) string {
// https://www.youtube.com/watch?v=YPN0qhSyWy8
cmd := shellCommand + " --version | grep -o -E \"([0-9]\\.?)*\" | head -n1"
out, _ := exec.Command("bash", "-c", cmd).Output()
return shellCommand + " " + strings.ReplaceAll(string(out), "\n", "")
return filepath.Base(shellCommand) + " " + strings.ReplaceAll(string(out), "\n", "")
}
func handleConfig() {
@ -105,10 +102,25 @@ func handlePrint(action, format string, rest string) {
}
}
}
func runpage() {
if utils.Ishelp {
println(`neowofetch version x (idk how to implement this)
--nouwu turns off uwuifying
--usepng uses a png (only supports arch and ubuntu rn)
--noascii turns off the ascii
--nocolor no color.
--noconf uses builtin config instead of looking for one in the filesystem
--nocolorconf same thing but for color config :P
--16color uses escape codes instead of RGB
--help YOU LITERALLY FUCKING RAN IT RIGHT NOW`)
os.Exit(0)
}
}
func main() {
checkforconfigfolder()
utils.Initargs()
runpage()
checkforconfigfolder()
utils.Initcolor()
utils.CutePrintInit()
handleConfig()

View file

@ -18,6 +18,7 @@ var Forceddistro string
var Defaultconf bool = false
var Defaultcolor bool = false
var colorold bool = false
var Ishelp bool = false
func Gethn() string {
cmd := exec.Command("whoami")
@ -50,8 +51,10 @@ func Initargs() {
Defaultcolor = true
case "--16color":
colorold = true
case "--help":
Ishelp = true
default:
print("unknown argument: ", argument, "\n")
print("unknown argument: ", argument, ". please run --help for help\n")
os.Exit(0)
}
}