summaryrefslogtreecommitdiff
path: root/ui/views/views.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/views.go')
-rw-r--r--ui/views/views.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/ui/views/views.go b/ui/views/views.go
new file mode 100644
index 0000000..18c1124
--- /dev/null
+++ b/ui/views/views.go
@@ -0,0 +1,45 @@
+package views
+
+import (
+ "os"
+ "os/exec"
+
+ "golang.org/x/term"
+)
+
+var logo = `
+▗▄▄▖ ▗▄▖ ▗▖ ▗▖ ▗▄▖ ▗▖ ▗▖▗▖ ▗▖ ▗▄▖
+▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▛▚▖▐▌▐▛▚▖▐▌▐▌ ▐▌
+▐▛▀▚▖▐▛▀▜▌▐▛▀▜▌▐▛▀▜▌▐▌ ▝▜▌▐▌ ▝▜▌▐▛▀▜▌
+▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌
+`
+
+// Get terminal size dynamically
+func GetTerminalSize() (width, height int) {
+ fd := int(os.Stdin.Fd())
+ if w, h, err := term.GetSize(fd); err == nil {
+ return w, h
+ }
+ return 80, 24 // Default size if detection fails
+}
+
+// Clear terminal screen
+func ClearScreen() {
+ cmd := exec.Command("clear") // Unix (Linux/macOS)
+ if os.Getenv("OS") == "Windows_NT" {
+ cmd = exec.Command("cmd", "/c", "cls") // Windows
+ }
+ cmd.Stdout = os.Stdout
+ cmd.Run()
+}
+
+func getFormWidth(width int) int {
+ formWidth := width * 2 / 3
+ if formWidth > 80 {
+ formWidth = 80 // Cap at 80 chars for readability
+ } else if formWidth < 40 {
+ formWidth = width - 4 // For small terminals
+ }
+
+ return formWidth
+}