v0.14.1 0da30ba

main.go RawHistoryFolder

1package main
2
3import (
4	"embed"
5	"log"
6	"os"
7	"runtime"
8
9	"github.com/bnema/dumber/internal/app/browser"
10	"github.com/bnema/dumber/internal/app/cli"
11	"github.com/bnema/dumber/internal/config"
12	"github.com/bnema/dumber/internal/logging"
13	"github.com/bnema/dumber/pkg/webkit"
14)
15
16//go:embed assets
17var assets embed.FS
18
19// Build information set via ldflags
20var (
21	version   = "dev"
22	commit    = "none"
23	buildDate = "unknown"
24)
25
26func main() {
27	// Setup basic crash handling early (before any potential crashes)
28	logging.SetupCrashHandler()
29
30	// Check if we should run the CLI mode
31	if shouldRunCLI() {
32		cli.Execute(version, commit, buildDate)
33		return
34	}
35
36	// Load config file first, then initialize logging with actual config
37	if err := config.Init(); err != nil {
38		log.Printf("Warning: failed to load config: %v, using defaults", err)
39	}
40	cfg := config.Get()
41
42	if err := logging.Init(
43		cfg.Logging.LogDir,
44		cfg.Logging.Level,
45		cfg.Logging.Format,
46		cfg.Logging.EnableFileLog,
47		cfg.Logging.MaxSize,
48		cfg.Logging.MaxBackups,
49		cfg.Logging.MaxAge,
50		cfg.Logging.Compress,
51	); err != nil {
52		log.Printf("Warning: failed to initialize logging: %v", err)
53	}
54
55	log.Printf("Starting dumber browser v%s (commit: %s, built: %s)", version, commit, buildDate)
56
57	// GTK requires all UI calls to run on the main OS thread
58	if webkit.IsNativeAvailable() {
59		runtime.LockOSThread()
60		defer runtime.UnlockOSThread()
61	}
62
63	// Otherwise run the GUI browser
64	browser.Run(assets, version, commit, buildDate)
65}
66
67// shouldRunCLI determines if we should run in CLI mode based on arguments
68func shouldRunCLI() bool {
69	// No args = show CLI help with available commands
70	if len(os.Args) <= 1 {
71		return true
72	}
73
74	// Check for GUI-specific flags
75	for _, arg := range os.Args[1:] {
76		if arg == "--gui" || arg == "-g" {
77			return false // Explicit GUI mode
78		}
79	}
80
81	// Check for browse command - this should open GUI in direct navigation mode
82	if len(os.Args) >= 2 && os.Args[1] == "browse" {
83		return false // Browse command uses GUI mode but navigates directly
84	}
85
86	// Any other arguments mean CLI mode
87	return true
88}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close