diff --git a/images/saul.png b/images/saul.png new file mode 100644 index 0000000..12c71b5 Binary files /dev/null and b/images/saul.png differ diff --git a/utils/args.go b/utils/args.go index 8f8303c..201a46f 100644 --- a/utils/args.go +++ b/utils/args.go @@ -13,16 +13,24 @@ var usepng bool = false var hascolor bool = true var Customascii = false var asciidir string +var asciiforced = false +var forceddistro string +func Gethn() string { + cmd := exec.Command("whoami") + shell, _ := cmd.Output() + return strings.Replace(string(shell), "\n", "", -1) +} func Initargs() { args = os.Args[1:] for _, argument := range args { if strings.HasPrefix(argument, "--ascii=") { - cmd := exec.Command("whoami") - shell, _ := cmd.Output() - funny := strings.Replace(string(shell), "\n", "", -1) Customascii = true - asciidir = strings.ReplaceAll(argument[8:], "~", "/home/"+funny) + asciidir = strings.ReplaceAll(argument[8:], "~", "/home/"+Gethn()) + } + if strings.HasPrefix(argument, "--distro=") { + asciiforced = true + forceddistro = argument[9:] } else if strings.HasPrefix(argument, "--") { switch argument { case "--nouwu": diff --git a/utils/printing.go b/utils/printing.go index 522b967..c4393db 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -59,12 +59,9 @@ func Initcolor() { func CutePrintInit() { dist := data.GetDistroVariable("ID") logo := Getascii(dist) - - if Customascii { - body, _ := ioutil.ReadFile(asciidir) - logo = (string(body)) + if asciiforced { + logo = Getascii(forceddistro) } - if noascii { logo = "" } @@ -72,6 +69,10 @@ func CutePrintInit() { pngData = images.DistroImages[dist] logo = strings.Repeat(" ", pngWidth) + " " + strings.Repeat("\n", pngHeight) } + if Customascii { + body, _ := ioutil.ReadFile(asciidir) + logo = (string(body)) + } logoLines = strings.Split(logo, "\n") logoWidth = 0 for _, v := range logoLines { @@ -147,6 +148,14 @@ func parseFormat(format string) (parsedFormat Format) { return parsedFormat } +func getcustomizeddistro() string { + if !asciiforced { + return data.GetDistroVariable("ID") + } else { + return forceddistro + } +} + func CutePrint( message string, format string, @@ -174,7 +183,7 @@ func CutePrintEnd() { fmt.Printf("\x1b[%dA", logoIndex) fmt.Printf("\x1b]1337;File=inline=1;width=%d;height=%d:", pngWidth, pngHeight) enc := base64.NewEncoder(base64.StdEncoding, os.Stdout) - enc.Write(images.DistroImages["arch"]) + enc.Write(images.DistroImages[getcustomizeddistro()]) enc.Close() fmt.Println("\a") }