v0.15.0 9006957

main.go RawHistoryFolder

1package main
2
3import (
4	"embed"
5	"fmt"
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		// Use fmt.Printf for early errors before logging is initialized
39		fmt.Printf("Warning: failed to load config: %v, using defaults\n", err)
40	}
41	cfg := config.Get()
42
43	if err := logging.Init(
44		cfg.Logging.LogDir,
45		cfg.Logging.Level,
46		cfg.Logging.Format,
47		cfg.Logging.EnableFileLog,
48		cfg.Logging.MaxSize,
49		cfg.Logging.MaxBackups,
50		cfg.Logging.MaxAge,
51		cfg.Logging.Compress,
52	); err != nil {
53		// Use fmt.Printf for early errors before logging is initialized
54		fmt.Printf("Warning: failed to initialize logging: %v\n", err)
55	}
56
57	logging.Info(fmt.Sprintf("Starting dumber browser v%s (commit: %s, built: %s)", version, commit, buildDate))
58
59	// GTK requires all UI calls to run on the main OS thread
60	if webkit.IsNativeAvailable() {
61		runtime.LockOSThread()
62		defer runtime.UnlockOSThread()
63	}
64
65	// Otherwise run the GUI browser
66	browser.Run(assets, version, commit, buildDate)
67}
68
69// shouldRunCLI determines if we should run in CLI mode based on arguments
70func shouldRunCLI() bool {
71	// No args = show CLI help with available commands
72	if len(os.Args) <= 1 {
73		return true
74	}
75
76	// Check for GUI-specific flags
77	for _, arg := range os.Args[1:] {
78		if arg == "--gui" || arg == "-g" {
79			return false // Explicit GUI mode
80		}
81	}
82
83	// Check for browse command - this should open GUI in direct navigation mode
84	if len(os.Args) >= 2 && os.Args[1] == "browse" {
85		return false // Browse command uses GUI mode but navigates directly
86	}
87
88	// Any other arguments mean CLI mode
89	return true
90}

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