mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DevourCharacter is the ASCII art representation of the Devour mascot
|
||||
// A documentation-devouring creature with cyan/teal coloring
|
||||
const DevourCharacter = `
|
||||
___
|
||||
.-' '-.
|
||||
/ \
|
||||
| O O |
|
||||
| __ |
|
||||
\ ' ' /
|
||||
'-.___.-'
|
||||
___ / \ ___
|
||||
_.-' '/ \' '-._
|
||||
_.-' | | '-._
|
||||
/ \ ___ / \
|
||||
| __ \ / \ / __ |
|
||||
| .' '. .---. | | .---. .' '. |
|
||||
| | | | | | | | | | | |
|
||||
\ \__/ / | | | | | \__/ /
|
||||
'.____.' | | | | '.____.'
|
||||
| | | |
|
||||
| | | |
|
||||
/ | | \
|
||||
/ | | \
|
||||
/ |_____| \
|
||||
/ / \ \
|
||||
/ / \ \
|
||||
/ / \ \
|
||||
/_____/ \_____\
|
||||
Devour - Documentation Devourer
|
||||
`
|
||||
|
||||
// DevourCharacterSmall is a smaller version for compact displays
|
||||
const DevourCharacterSmall = `
|
||||
___
|
||||
.-' '-.
|
||||
/ O O \
|
||||
| _ |
|
||||
\ '-' /
|
||||
'-.___.-'
|
||||
Documentation Devourer
|
||||
`
|
||||
|
||||
// DevourLogo is a stylized text logo
|
||||
const DevourLogo = `
|
||||
____ _____ __________ _____ ____ _____
|
||||
| _ \| ____| ___| ___|_ _| _ \| ____|
|
||||
| | | | _| | |_ | |_ | | | | | | _|
|
||||
| |_| | |___| _| | _| | | | |_| | |___
|
||||
|____/|_____|_| |_| |_| |____/|_____|
|
||||
Documentation Devourer
|
||||
`
|
||||
|
||||
// DevourBanner combines the character with version info
|
||||
const DevourBanner = `
|
||||
___
|
||||
.-' '-.
|
||||
/ O O \
|
||||
| _ |
|
||||
\ '-' /
|
||||
'-.___.-'
|
||||
____ _____ __________ _____
|
||||
| _ \| ____| ___| ___|_ _|
|
||||
| | | | _| | |_ | |_ | |
|
||||
| |_| | |___| _| | _| | |
|
||||
|____/|_____|_| |_| |_|
|
||||
|
||||
Documentation Devourer v%s
|
||||
`
|
||||
|
||||
// PrintCharacter prints the full ASCII character
|
||||
func PrintCharacter() {
|
||||
fmt.Println(DevourCharacter)
|
||||
}
|
||||
|
||||
// PrintCharacterSmall prints the smaller character version
|
||||
func PrintCharacterSmall() {
|
||||
fmt.Println(DevourCharacterSmall)
|
||||
}
|
||||
|
||||
// PrintLogo prints just the text logo
|
||||
func PrintLogo() {
|
||||
fmt.Println(DevourLogo)
|
||||
}
|
||||
|
||||
// PrintBanner prints the character with version info
|
||||
func PrintBanner(version string) {
|
||||
fmt.Printf(DevourBanner, version)
|
||||
}
|
||||
|
||||
// GetCharacter returns the character string
|
||||
func GetCharacter() string {
|
||||
return DevourCharacter
|
||||
}
|
||||
|
||||
// GetCharacterSmall returns the small character string
|
||||
func GetCharacterSmall() string {
|
||||
return DevourCharacterSmall
|
||||
}
|
||||
|
||||
// GetLogo returns the logo string
|
||||
func GetLogo() string {
|
||||
return DevourLogo
|
||||
}
|
||||
|
||||
// GetBanner returns the formatted banner string
|
||||
func GetBanner(version string) string {
|
||||
return fmt.Sprintf(DevourBanner, version)
|
||||
}
|
||||
|
||||
// PrintWelcome prints a welcome message with the character
|
||||
func PrintWelcome(version string) {
|
||||
PrintBanner(version)
|
||||
fmt.Println()
|
||||
fmt.Println(" Context ingestion and management for AI")
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
// PrintWithColor prints the character with ANSI color codes (cyan/teal theme)
|
||||
func PrintWithColor(useColor bool) {
|
||||
if useColor {
|
||||
// Cyan color for the character
|
||||
cyan := "\033[36m"
|
||||
reset := "\033[0m"
|
||||
fmt.Printf("%s%s%s", cyan, DevourCharacter, reset)
|
||||
} else {
|
||||
PrintCharacter()
|
||||
}
|
||||
}
|
||||
|
||||
// GetColoredCharacter returns the character with ANSI color codes
|
||||
func GetColoredCharacter(useColor bool) string {
|
||||
if useColor {
|
||||
cyan := "\033[36m"
|
||||
reset := "\033[0m"
|
||||
return cyan + DevourCharacter + reset
|
||||
}
|
||||
return DevourCharacter
|
||||
}
|
||||
|
||||
// PrintStatusWithCharacter prints status output with the small character
|
||||
func PrintStatusWithCharacter(statusLines []string) {
|
||||
// Print small character on the left
|
||||
lines := strings.Split(DevourCharacterSmall, "\n")
|
||||
maxWidth := 0
|
||||
for _, line := range lines {
|
||||
if len(line) > maxWidth {
|
||||
maxWidth = len(line)
|
||||
}
|
||||
}
|
||||
|
||||
// Pad character lines and add status
|
||||
charIdx := 0
|
||||
statusIdx := 0
|
||||
|
||||
for charIdx < len(lines) || statusIdx < len(statusLines) {
|
||||
if charIdx < len(lines) {
|
||||
line := lines[charIdx]
|
||||
// Pad to align status
|
||||
padding := maxWidth - len(line)
|
||||
if statusIdx < len(statusLines) {
|
||||
fmt.Printf("%s%s %s\n", line, strings.Repeat(" ", padding+2), statusLines[statusIdx])
|
||||
statusIdx++
|
||||
} else {
|
||||
fmt.Println(line)
|
||||
}
|
||||
charIdx++
|
||||
} else if statusIdx < len(statusLines) {
|
||||
fmt.Printf("%s %s\n", strings.Repeat(" ", maxWidth+2), statusLines[statusIdx])
|
||||
statusIdx++
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user