detached 00eb4e3

fix(cli): prevent typos from being treated as URLs

Remove URL argument handling from root command to properly catch
command typos. Previously 'dumber pruge' would search Google for
'pruge' instead of showing 'unknown command' error.

Users must now use 'dumber browse <url>' explicitly.
commit
00eb4e3b003de33a7805bcde328cf2233145302f
author
bnema · · 2025-10-24 04:43 UTC
committer
bnema · · 2025-10-24 17:33 UTC
parent
6b6efd7
signature
GPG Unverified2B82207D370127A0 The key is unknown
1 file · +3 -20
M internal/cli/root.go +3 -20
@@ -95,28 +95,11 @@ func (c *CLI) Close() error {
9595 // NewRootCmd creates the root command for dumber
9696 func NewRootCmd(version, commit, buildDate string) *cobra.Command {
9797 rootCmd := &cobra.Command{
98- Use: "dumber [url]",
98+ Use: "dumber",
9999 Short: "A dumb browser for Wayland window managers",
100100 Long: `A fast, simple browser with rofi/dmenu integration for sway and hyprland window managers.`,
101- Args: cobra.MaximumNArgs(1),
102- RunE: func(cmd *cobra.Command, args []string) error {
103- // Initialize CLI
104- cli, err := NewCLI()
105- if err != nil {
106- return fmt.Errorf("failed to initialize CLI: %w", err)
107- }
108- defer func() {
109- if closeErr := cli.Close(); closeErr != nil {
110- fmt.Fprintf(os.Stderr, "Warning: failed to close database: %v\n", closeErr)
111- }
112- }()
113-
114- // If URL provided, browse it directly
115- if len(args) > 0 {
116- return browse(cli, args[0])
117- }
118-
119- // Otherwise show help
101+ RunE: func(cmd *cobra.Command, _ []string) error {
102+ // Show help when no subcommand is provided
120103 return cmd.Help()
121104 },
122105 }
@@ -95,28 +95,11 @@ func (c *CLI) Close() error {
95 // NewRootCmd creates the root command for dumber95 // NewRootCmd creates the root command for dumber
96 func NewRootCmd(version, commit, buildDate string) *cobra.Command {96 func NewRootCmd(version, commit, buildDate string) *cobra.Command {
97 rootCmd := &cobra.Command{97 rootCmd := &cobra.Command{
98- Use: "dumber [url]",98+ Use: "dumber",
99 Short: "A dumb browser for Wayland window managers",99 Short: "A dumb browser for Wayland window managers",
100 Long: `A fast, simple browser with rofi/dmenu integration for sway and hyprland window managers.`,100 Long: `A fast, simple browser with rofi/dmenu integration for sway and hyprland window managers.`,
101- Args: cobra.MaximumNArgs(1),101+ RunE: func(cmd *cobra.Command, _ []string) error {
102- RunE: func(cmd *cobra.Command, args []string) error {102+ // Show help when no subcommand is provided
103- // Initialize CLI
104- cli, err := NewCLI()
105- if err != nil {
106- return fmt.Errorf("failed to initialize CLI: %w", err)
107- }
108- defer func() {
109- if closeErr := cli.Close(); closeErr != nil {
110- fmt.Fprintf(os.Stderr, "Warning: failed to close database: %v\n", closeErr)
111- }
112- }()
113-
114- // If URL provided, browse it directly
115- if len(args) > 0 {
116- return browse(cli, args[0])
117- }
118-
119- // Otherwise show help
120 return cmd.Help()103 return cmd.Help()
121 },104 },
122 }105 }

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