|
| 1 | +package banner |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "strings" |
| 6 | + "time" |
| 7 | +) |
| 8 | + |
| 9 | +// Color codes |
| 10 | +const ( |
| 11 | + Reset = "\033[0m" |
| 12 | + Cyan = "\033[36m" |
| 13 | + Purple = "\033[35m" |
| 14 | + Green = "\033[32m" |
| 15 | + Yellow = "\033[33m" |
| 16 | + Bold = "\033[1m" |
| 17 | +) |
| 18 | + |
| 19 | +// ASCII art for vLLM Semantic Router |
| 20 | +var logo = []string{ |
| 21 | + " ██╗ ██╗██╗ ██╗ ███╗ ███╗", |
| 22 | + " ██║ ██║██║ ██║ ████╗ ████║", |
| 23 | + " ██║ ██║██║ ██║ ██╔████╔██║", |
| 24 | + " ╚██╗ ██╔╝██║ ██║ ██║╚██╔╝██║", |
| 25 | + " ╚████╔╝ ███████╗███████╗██║ ╚═╝ ██║", |
| 26 | + " ╚═══╝ ╚══════╝╚══════╝╚═╝ ╚═╝", |
| 27 | + "", |
| 28 | + " ███████╗███████╗███╗ ███╗ █████╗ ███╗ ██╗████████╗██╗ ██████╗", |
| 29 | + " ██╔════╝██╔════╝████╗ ████║██╔══██╗████╗ ██║╚══██╔══╝██║██╔════╝", |
| 30 | + " ███████╗█████╗ ██╔████╔██║███████║██╔██╗ ██║ ██║ ██║██║ ", |
| 31 | + " ╚════██║██╔══╝ ██║╚██╔╝██║██╔══██║██║╚██╗██║ ██║ ██║██║ ", |
| 32 | + " ███████║███████╗██║ ╚═╝ ██║██║ ██║██║ ╚████║ ██║ ██║╚██████╗", |
| 33 | + " ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝", |
| 34 | + "", |
| 35 | + " ██████╗ ██████╗ ██╗ ██╗████████╗███████╗██████╗", |
| 36 | + " ██╔══██╗██╔═══██╗██║ ██║╚══██╔══╝██╔════╝██╔══██╗", |
| 37 | + " ██████╔╝██║ ██║██║ ██║ ██║ █████╗ ██████╔╝", |
| 38 | + " ██╔══██╗██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗", |
| 39 | + " ██║ ██║╚██████╔╝╚██████╔╝ ██║ ███████╗██║ ██║", |
| 40 | + " ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝", |
| 41 | +} |
| 42 | + |
| 43 | +// Show displays the animated banner |
| 44 | +func Show(version string) { |
| 45 | + fmt.Println() |
| 46 | + fmt.Println() |
| 47 | + |
| 48 | + // Animate logo line by line |
| 49 | + for _, line := range logo { |
| 50 | + fmt.Printf("%s%s%s%s\n", Bold, Cyan, line, Reset) |
| 51 | + time.Sleep(30 * time.Millisecond) |
| 52 | + } |
| 53 | + |
| 54 | + fmt.Println() |
| 55 | + |
| 56 | + // Show version and info with animation |
| 57 | + info := []string{ |
| 58 | + fmt.Sprintf("%s%s E2E Testing Framework%s", Bold, Purple, Reset), |
| 59 | + fmt.Sprintf("%s Version: %s%s", Yellow, version, Reset), |
| 60 | + "", |
| 61 | + } |
| 62 | + |
| 63 | + for _, line := range info { |
| 64 | + fmt.Println(line) |
| 65 | + time.Sleep(50 * time.Millisecond) |
| 66 | + } |
| 67 | + |
| 68 | + // Loading animation |
| 69 | + loadingChars := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"} |
| 70 | + fmt.Print(Green + " Initializing" + Reset) |
| 71 | + for i := 0; i < 15; i++ { |
| 72 | + fmt.Printf("\r%s Initializing %s%s", Green, loadingChars[i%len(loadingChars)], Reset) |
| 73 | + time.Sleep(80 * time.Millisecond) |
| 74 | + } |
| 75 | + fmt.Printf("\r%s Initializing ✓%s\n", Green, Reset) |
| 76 | + |
| 77 | + fmt.Println() |
| 78 | + fmt.Println(strings.Repeat("═", 80)) |
| 79 | + fmt.Println() |
| 80 | +} |
| 81 | + |
| 82 | +// ShowQuick displays a quick version without animation (for CI/non-interactive) |
| 83 | +func ShowQuick(version string) { |
| 84 | + fmt.Println() |
| 85 | + fmt.Println() |
| 86 | + |
| 87 | + for _, line := range logo { |
| 88 | + fmt.Printf("%s%s%s%s\n", Bold, Cyan, line, Reset) |
| 89 | + } |
| 90 | + |
| 91 | + fmt.Println() |
| 92 | + fmt.Printf("%s%s E2E Testing Framework%s\n", Bold, Purple, Reset) |
| 93 | + fmt.Printf("%s Version: %s%s\n", Yellow, version, Reset) |
| 94 | + fmt.Println() |
| 95 | + fmt.Println(strings.Repeat("═", 80)) |
| 96 | + fmt.Println() |
| 97 | +} |
0 commit comments