yeah
This commit is contained in:
parent
1c02e71c47
commit
c6577fe71f
3 changed files with 27 additions and 10 deletions
BIN
images/saul.png
Normal file
BIN
images/saul.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 KiB |
|
@ -13,16 +13,24 @@ var usepng bool = false
|
||||||
var hascolor bool = true
|
var hascolor bool = true
|
||||||
var Customascii = false
|
var Customascii = false
|
||||||
var asciidir string
|
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() {
|
func Initargs() {
|
||||||
args = os.Args[1:]
|
args = os.Args[1:]
|
||||||
for _, argument := range args {
|
for _, argument := range args {
|
||||||
if strings.HasPrefix(argument, "--ascii=") {
|
if strings.HasPrefix(argument, "--ascii=") {
|
||||||
cmd := exec.Command("whoami")
|
|
||||||
shell, _ := cmd.Output()
|
|
||||||
funny := strings.Replace(string(shell), "\n", "", -1)
|
|
||||||
Customascii = true
|
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, "--") {
|
} else if strings.HasPrefix(argument, "--") {
|
||||||
switch argument {
|
switch argument {
|
||||||
case "--nouwu":
|
case "--nouwu":
|
||||||
|
|
|
@ -59,12 +59,9 @@ func Initcolor() {
|
||||||
func CutePrintInit() {
|
func CutePrintInit() {
|
||||||
dist := data.GetDistroVariable("ID")
|
dist := data.GetDistroVariable("ID")
|
||||||
logo := Getascii(dist)
|
logo := Getascii(dist)
|
||||||
|
if asciiforced {
|
||||||
if Customascii {
|
logo = Getascii(forceddistro)
|
||||||
body, _ := ioutil.ReadFile(asciidir)
|
|
||||||
logo = (string(body))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if noascii {
|
if noascii {
|
||||||
logo = ""
|
logo = ""
|
||||||
}
|
}
|
||||||
|
@ -72,6 +69,10 @@ func CutePrintInit() {
|
||||||
pngData = images.DistroImages[dist]
|
pngData = images.DistroImages[dist]
|
||||||
logo = strings.Repeat(" ", pngWidth) + " " + strings.Repeat("\n", pngHeight)
|
logo = strings.Repeat(" ", pngWidth) + " " + strings.Repeat("\n", pngHeight)
|
||||||
}
|
}
|
||||||
|
if Customascii {
|
||||||
|
body, _ := ioutil.ReadFile(asciidir)
|
||||||
|
logo = (string(body))
|
||||||
|
}
|
||||||
logoLines = strings.Split(logo, "\n")
|
logoLines = strings.Split(logo, "\n")
|
||||||
logoWidth = 0
|
logoWidth = 0
|
||||||
for _, v := range logoLines {
|
for _, v := range logoLines {
|
||||||
|
@ -147,6 +148,14 @@ func parseFormat(format string) (parsedFormat Format) {
|
||||||
return parsedFormat
|
return parsedFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getcustomizeddistro() string {
|
||||||
|
if !asciiforced {
|
||||||
|
return data.GetDistroVariable("ID")
|
||||||
|
} else {
|
||||||
|
return forceddistro
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CutePrint(
|
func CutePrint(
|
||||||
message string,
|
message string,
|
||||||
format string,
|
format string,
|
||||||
|
@ -174,7 +183,7 @@ func CutePrintEnd() {
|
||||||
fmt.Printf("\x1b[%dA", logoIndex)
|
fmt.Printf("\x1b[%dA", logoIndex)
|
||||||
fmt.Printf("\x1b]1337;File=inline=1;width=%d;height=%d:", pngWidth, pngHeight)
|
fmt.Printf("\x1b]1337;File=inline=1;width=%d;height=%d:", pngWidth, pngHeight)
|
||||||
enc := base64.NewEncoder(base64.StdEncoding, os.Stdout)
|
enc := base64.NewEncoder(base64.StdEncoding, os.Stdout)
|
||||||
enc.Write(images.DistroImages["arch"])
|
enc.Write(images.DistroImages[getcustomizeddistro()])
|
||||||
enc.Close()
|
enc.Close()
|
||||||
fmt.Println("\a")
|
fmt.Println("\a")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue