remove reuse

This commit is contained in:
nekohepott 2026-06-17 04:16:28 +03:00
parent c96d264fcd
commit 3a1873a747
No known key found for this signature in database

View File

@ -128,6 +128,19 @@ func main() {
statsLines = append(statsLines, fmt.Sprintf("%s %s%s%s: %s", key, statColor, info.Label, providers.Reset, info.Value))
}
fallbackToAscii := func(path *string) []string {
parts := strings.Split(*path, ".")
if len(parts) > 1 {
parts[len(parts)-1] = "txt"
}
*path = strings.Join(parts, ".")
if !strings.HasSuffix(*path, ".txt") {
fmt.Println("chafa binary not found, to print images please install chafa")
}
return providers.SplitLines(providers.PrintAsciiLogo(*path))
}
var logoLines []string
if _, err := os.Stat(*logoPath); err == nil {
if conf.Ascii || (ascii != nil && *ascii) {
@ -136,28 +149,11 @@ func main() {
if err := providers.RenderLogoChafaAnimated(*logoPath, uint(*width), statsLines, position); err == nil {
return
}
parts := strings.Split(*logoPath, ".")
if len(parts) > 1 {
parts[1] = "txt"
}
*logoPath = strings.Join(parts, ".")
logoLines = providers.SplitLines(providers.PrintAsciiLogo(*logoPath))
if strings.Contains(*logoPath, ".txt") != true {
fmt.Printf("chafa binary not found, to print images please install chafa\n")
}
logoLines = fallbackToAscii(logoPath)
} else {
logoLines, err = providers.RenderLogoChafa(*logoPath, uint(*width))
if err != nil {
parts := strings.Split(*logoPath, ".")
if len(parts) > 1 {
parts[1] = "txt"
}
*logoPath = strings.Join(parts, ".")
logoLines = providers.SplitLines(providers.PrintAsciiLogo(*logoPath))
if strings.Contains(*logoPath, ".txt") != true {
fmt.Printf("chafa binary not found, to print images please install chafa\n")
}
logoLines = fallbackToAscii(logoPath)
}
}
} else {