From 99a6d517177503128c82cd3057d790ee1d8b0417 Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Sun, 25 Sep 2022 11:54:09 +0330 Subject: [PATCH] added custom ascii support --- utils/args.go | 19 ++++++++++--------- utils/printing.go | 9 ++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/utils/args.go b/utils/args.go index 1508e88..8f8303c 100644 --- a/utils/args.go +++ b/utils/args.go @@ -2,6 +2,7 @@ package utils import ( "os" + "os/exec" "strings" ) @@ -10,11 +11,19 @@ var shoulduwuify bool = true var noascii bool = false var usepng bool = false var hascolor bool = true +var Customascii = false +var asciidir string func Initargs() { args = os.Args[1:] for _, argument := range args { - if strings.HasPrefix(argument, "--") { + 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) + } else if strings.HasPrefix(argument, "--") { switch argument { case "--nouwu": shoulduwuify = false @@ -32,11 +41,3 @@ func Initargs() { func Woulduwuify() bool { return shoulduwuify } -func Asciioverwrite(ascii []string) []string { - if noascii { - literallynothing := []string{"", ""} - return (literallynothing) - } else { - return ascii - } -} diff --git a/utils/printing.go b/utils/printing.go index ee9d496..522b967 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -3,6 +3,7 @@ package utils import ( "encoding/base64" "fmt" + "io/ioutil" "os" "path/filepath" "strconv" @@ -58,6 +59,12 @@ func Initcolor() { func CutePrintInit() { dist := data.GetDistroVariable("ID") logo := Getascii(dist) + + if Customascii { + body, _ := ioutil.ReadFile(asciidir) + logo = (string(body)) + } + if noascii { logo = "" } @@ -70,7 +77,7 @@ func CutePrintInit() { for _, v := range logoLines { lineLength := len([]rune(v)) if lineLength > logoWidth { - logoWidth = lineLength + logoWidth = lineLength + 2 } } }