This commit is contained in:
echo 2022-09-25 13:57:18 +03:30
parent 1c02e71c47
commit c6577fe71f
3 changed files with 27 additions and 10 deletions

BIN
images/saul.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

View file

@ -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":

View file

@ -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")
}