-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
77 lines (64 loc) · 1.73 KB
/
main.go
File metadata and controls
77 lines (64 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/mdipanjan/hive/internal/cli"
"github.com/mdipanjan/hive/internal/components"
"github.com/mdipanjan/hive/internal/config"
"github.com/mdipanjan/hive/internal/styles"
"github.com/mdipanjan/hive/internal/tui"
)
var Version = "dev"
func main() {
if len(os.Args) > 1 {
switch os.Args[1] {
case "-v", "--version", "version":
fmt.Println("hive", Version)
return
case "-h", "--help", "help":
printHelp()
return
}
if cli.Run(os.Args) {
return
}
}
components.Version = Version
cfg := config.Load()
theme := styles.GetThemeByKey(cfg.Theme)
styles.ApplyTheme(theme)
p := tea.NewProgram(tui.New(), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
}
func printHelp() {
fmt.Println(`hive - lightweight TUI for managing tmux sessions
Usage:
hive Start the TUI
hive -v, --version Show version
hive -h, --help Show this help
Commands:
hive list [--json] List all sessions
hive create [options] Create a new session
--tool <tool> Tool: pi, claude, bash (default: bash)
--path <path> Working directory (default: .)
--name <name> Session name (auto-generated if empty)
hive attach <name> Attach to a session
hive delete <name> Delete a session
Aliases:
list → ls
create → new
attach → a
delete → rm
TUI Keys:
n New session
enter Attach to session
d Delete session
/ Search sessions
t Switch theme
? Help
q Quit`)
}