added custom ascii support

This commit is contained in:
echo 2022-09-25 11:54:09 +03:30 committed by nea
parent 9e36993b9f
commit 99a6d51717
No known key found for this signature in database
GPG key ID: AA563E93EB628D91
2 changed files with 18 additions and 10 deletions

View file

@ -2,6 +2,7 @@ package utils
import ( import (
"os" "os"
"os/exec"
"strings" "strings"
) )
@ -10,11 +11,19 @@ var shoulduwuify bool = true
var noascii bool = false var noascii bool = false
var usepng bool = false var usepng bool = false
var hascolor bool = true var hascolor bool = true
var Customascii = false
var asciidir string
func Initargs() { func Initargs() {
args = os.Args[1:] args = os.Args[1:]
for _, argument := range args { 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 { switch argument {
case "--nouwu": case "--nouwu":
shoulduwuify = false shoulduwuify = false
@ -32,11 +41,3 @@ func Initargs() {
func Woulduwuify() bool { func Woulduwuify() bool {
return shoulduwuify return shoulduwuify
} }
func Asciioverwrite(ascii []string) []string {
if noascii {
literallynothing := []string{"", ""}
return (literallynothing)
} else {
return ascii
}
}

View file

@ -3,6 +3,7 @@ package utils
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@ -58,6 +59,12 @@ func Initcolor() {
func CutePrintInit() { func CutePrintInit() {
dist := data.GetDistroVariable("ID") dist := data.GetDistroVariable("ID")
logo := Getascii(dist) logo := Getascii(dist)
if Customascii {
body, _ := ioutil.ReadFile(asciidir)
logo = (string(body))
}
if noascii { if noascii {
logo = "" logo = ""
} }
@ -70,7 +77,7 @@ func CutePrintInit() {
for _, v := range logoLines { for _, v := range logoLines {
lineLength := len([]rune(v)) lineLength := len([]rune(v))
if lineLength > logoWidth { if lineLength > logoWidth {
logoWidth = lineLength logoWidth = lineLength + 2
} }
} }
} }