first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
package logo
import (
"fmt"
"strings"
)
const compact = "BIFROST CLI"
// Render returns the ASCII logo for the given terminal width.
func Render(width int) string {
if width < 61 {
return compact
}
return strings.Join([]string{
"╔═══════════════════════════════════════════════════════════╗",
"║ ║",
"║ ██████╗ ██╗███████╗██████╗ ██████╗ ███████╗████████╗ ║",
"║ ██╔══██╗██║██╔════╝██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝ ║",
"║ ██████╔╝██║█████╗ ██████╔╝██║ ██║███████╗ ██║ ║",
"║ ██╔══██╗██║██╔══╝ ██╔══██╗██║ ██║╚════██║ ██║ ║",
"║ ██████╔╝██║██║ ██║ ██║╚██████╔╝███████║ ██║ ║",
"║ ╚═════╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ║",
"║ ║",
"║═══════════════════════════════════════════════════════════║",
"║ CLI ║",
"║═══════════════════════════════════════════════════════════║",
"║ https://github.com/maximhq/bifrost ║",
"╚═══════════════════════════════════════════════════════════╝",
}, "\n")
}
// BootHeader builds the full boot header with the ASCII logo and version info.
func BootHeader(width int, version, commit, source string, noColor bool) string {
if width < 61 {
meta := fmt.Sprintf("%s (%s)", version, commit)
return fmt.Sprintf("\n\n%s\n%s", Render(width), meta)
}
meta := fmt.Sprintf("%s (%s) config=%s", version, commit, source)
var b strings.Builder
b.WriteString("\n\n")
b.WriteString(Render(width))
b.WriteString("\n")
if noColor {
b.WriteString(meta)
} else {
b.WriteString("\033[2;36m" + meta + "\033[0m")
}
b.WriteString("\n")
return b.String()
}

View File

@@ -0,0 +1,30 @@
package logo
import (
"strings"
"testing"
)
func TestRenderLarge(t *testing.T) {
got := Render(120)
if !strings.Contains(got, "██████╗") {
t.Fatalf("expected large logo, got %q", got)
}
}
func TestRenderCompact(t *testing.T) {
got := Render(20)
if got != "BIFROST CLI" {
t.Fatalf("expected compact logo, got %q", got)
}
}
func TestBootHeaderStartsWithLogo(t *testing.T) {
header := BootHeader(120, "v1", "abc", "none", true)
if !strings.Contains(header, Render(120)) {
t.Fatalf("expected boot header to contain logo")
}
if !strings.Contains(header, "config=none") {
t.Fatalf("expected boot header to contain config source")
}
}