detached 5fcbde5

feat(cli): improve purge command flag clarity

Rename flags for better understanding:
- Split generic --cache into --history-cache and --browser-cache
- Rename --webkit-data to --browser-data for clarity
- Add short flags: -H (history-cache), -c (browser-cache), -b (browser-data)
- Update documentation and examples to reflect new flag names
- Clarify distinction between dmenu fuzzy cache vs WebKit browser cache
commit
5fcbde5d7dab78208064dcb3ef8afa8d6ee3e5b4
author
Brice · · 2025-09-10 20:25 UTC
parent
d4c1f57
signature
unsigned
3 files · +49 -42
M CHANGELOG.md +3 -1
@@ -17,7 +17,9 @@ All notable changes to this project will be documented in this file.
1717 - Atomic operations for concurrent access control
1818 - Dependency injection using interfaces and gomock for testing
1919 - Purge command for cleaning up dumber data and cache files:
20- - Selective purging with flags: `--database`, `--cache`, `--webkit-data`, `--state`, `--config`
20+ - Selective purging with flags: `--database`, `--history-cache`, `--browser-cache`, `--browser-data`, `--state`, `--config`
21+ - Clear distinction between history cache (dmenu fuzzy search) and browser cache (WebKit)
22+ - Browser data includes cookies, localStorage, sessionStorage
2123 - Confirmation prompt with `--force` flag to skip
2224 - Targets all data locations: SQLite database, WebKit cache/data, dmenu fuzzy cache, configuration files
2325
@@ -17,7 +17,9 @@ All notable changes to this project will be documented in this file.
17 - Atomic operations for concurrent access control17 - Atomic operations for concurrent access control
18 - Dependency injection using interfaces and gomock for testing18 - Dependency injection using interfaces and gomock for testing
19 - Purge command for cleaning up dumber data and cache files:19 - Purge command for cleaning up dumber data and cache files:
20- - Selective purging with flags: `--database`, `--cache`, `--webkit-data`, `--state`, `--config`20+ - Selective purging with flags: `--database`, `--history-cache`, `--browser-cache`, `--browser-data`, `--state`, `--config`
21+ - Clear distinction between history cache (dmenu fuzzy search) and browser cache (WebKit)
22+ - Browser data includes cookies, localStorage, sessionStorage
21 - Confirmation prompt with `--force` flag to skip23 - Confirmation prompt with `--force` flag to skip
22 - Targets all data locations: SQLite database, WebKit cache/data, dmenu fuzzy cache, configuration files24 - Targets all data locations: SQLite database, WebKit cache/data, dmenu fuzzy cache, configuration files
23 25
M README.md +4 -4
@@ -104,10 +104,10 @@ Development:
104104 - rofi: `dumber dmenu | rofi -dmenu -p "Browse: " | dumber dmenu --select`
105105 - fuzzel: `dumber dmenu | fuzzel --dmenu -p "Browse: " | dumber dmenu --select`
106106 - Clean up data and cache:
107- - `dumber purge` # purge all data (with confirmation)
108- - `dumber purge --force` # purge all data (no confirmation)
109- - `dumber purge --database --cache` # purge only database and caches
110- - `dumber purge --webkit-data` # purge only WebKit data (cookies, etc.)
107+ - `dumber purge` # purge all data (with confirmation)
108+ - `dumber purge --force` # purge all data (no confirmation)
109+ - `dumber purge -d -H -c` # purge database and both caches
110+ - `dumber purge --browser-data` # purge WebKit data (cookies, etc.)
111111
112112 ### Dmenu mode invocation
113113 You can invoke dmenu mode in two ways:
@@ -104,10 +104,10 @@ Development:
104 - rofi: `dumber dmenu | rofi -dmenu -p "Browse: " | dumber dmenu --select`104 - rofi: `dumber dmenu | rofi -dmenu -p "Browse: " | dumber dmenu --select`
105 - fuzzel: `dumber dmenu | fuzzel --dmenu -p "Browse: " | dumber dmenu --select`105 - fuzzel: `dumber dmenu | fuzzel --dmenu -p "Browse: " | dumber dmenu --select`
106 - Clean up data and cache:106 - Clean up data and cache:
107- - `dumber purge` # purge all data (with confirmation)107+ - `dumber purge` # purge all data (with confirmation)
108- - `dumber purge --force` # purge all data (no confirmation)108+ - `dumber purge --force` # purge all data (no confirmation)
109- - `dumber purge --database --cache` # purge only database and caches109+ - `dumber purge -d -H -c` # purge database and both caches
110- - `dumber purge --webkit-data` # purge only WebKit data (cookies, etc.)110+ - `dumber purge --browser-data` # purge WebKit data (cookies, etc.)
111 111
112 ### Dmenu mode invocation112 ### Dmenu mode invocation
113 You can invoke dmenu mode in two ways:113 You can invoke dmenu mode in two ways:
M internal/cli/purge.go +42 -37
@@ -13,13 +13,14 @@ import (
1313
1414 // PurgeFlags holds all the purge command flags
1515 type PurgeFlags struct {
16- Database bool
17- Cache bool
18- State bool
19- WebkitData bool
20- Config bool
21- All bool
22- Force bool
16+ Database bool
17+ HistoryCache bool
18+ BrowserCache bool
19+ BrowserData bool
20+ State bool
21+ Config bool
22+ All bool
23+ Force bool
2324 }
2425
2526 // NewPurgeCmd creates the purge command
@@ -32,20 +33,21 @@ func NewPurgeCmd() *cobra.Command {
3233 Long: `Purge various dumber data and cache files. By default, purges everything.
3334
3435 Available purge targets:
35- --database, -d Purge the SQLite database (history, shortcuts, zoom levels)
36- --cache, -c Purge WebKit cache and dmenu fuzzy search cache
37- --state, -s Purge all state data (includes database and caches)
38- --webkit-data, -w Purge WebKit data (cookies, local storage, session data)
39- --config Purge configuration files
40- --all, -a Purge everything (default if no specific flags are provided)
36+ --database, -d Purge the SQLite database (history, shortcuts, zoom levels)
37+ --history-cache, -H Purge dmenu fuzzy search cache for history
38+ --browser-cache, -c Purge WebKit browser cache (cached images, files, etc.)
39+ --browser-data, -b Purge WebKit browser data (cookies, localStorage, sessionStorage)
40+ --state, -s Purge all state data (includes database and caches)
41+ --config Purge configuration files
42+ --all, -a Purge everything (default if no specific flags are provided)
4143
4244 Use --force to skip the confirmation prompt.
4345
4446 Examples:
4547 dumber purge # Purge everything (with confirmation)
4648 dumber purge --force # Purge everything (no confirmation)
47- dumber purge -d -c # Purge only database and caches
48- dumber purge --webkit-data -f # Force purge WebKit data only`,
49+ dumber purge -d -H -c # Purge database and both caches
50+ dumber purge --browser-data -f # Force purge browser data only`,
4951 RunE: func(_ *cobra.Command, _ []string) error {
5052 // Initialize CLI to get config paths
5153 cli, err := NewCLI()
@@ -64,9 +66,10 @@ Examples:
6466
6567 // Add flags
6668 cmd.Flags().BoolVarP(&flags.Database, "database", "d", false, "Purge the SQLite database")
67- cmd.Flags().BoolVarP(&flags.Cache, "cache", "c", false, "Purge WebKit cache and dmenu fuzzy cache")
69+ cmd.Flags().BoolVarP(&flags.HistoryCache, "history-cache", "H", false, "Purge dmenu fuzzy search cache")
70+ cmd.Flags().BoolVarP(&flags.BrowserCache, "browser-cache", "c", false, "Purge WebKit browser cache")
71+ cmd.Flags().BoolVarP(&flags.BrowserData, "browser-data", "b", false, "Purge WebKit browser data (cookies, localStorage)")
6872 cmd.Flags().BoolVarP(&flags.State, "state", "s", false, "Purge all state data")
69- cmd.Flags().BoolVarP(&flags.WebkitData, "webkit-data", "w", false, "Purge WebKit data (cookies, local storage)")
7073 cmd.Flags().BoolVar(&flags.Config, "config", false, "Purge configuration files")
7174 cmd.Flags().BoolVarP(&flags.All, "all", "a", false, "Purge everything")
7275 cmd.Flags().BoolVarP(&flags.Force, "force", "f", false, "Skip confirmation prompt")
@@ -106,23 +109,26 @@ func determinePurgeItems(flags PurgeFlags) []string {
106109 var items []string
107110
108111 // If no specific flags are set, or --all is set, purge everything
109- if flags.All || (!flags.Database && !flags.Cache && !flags.State && !flags.WebkitData && !flags.Config) {
110- return []string{"database", "cache", "webkit-data", "config"}
112+ if flags.All || (!flags.Database && !flags.HistoryCache && !flags.BrowserCache && !flags.BrowserData && !flags.State && !flags.Config) {
113+ return []string{"database", "history-cache", "browser-cache", "browser-data", "config"}
111114 }
112115
113116 // Add items based on flags
114117 if flags.Database {
115118 items = append(items, "database")
116119 }
117- if flags.Cache {
118- items = append(items, "cache")
120+ if flags.HistoryCache {
121+ items = append(items, "history-cache")
119122 }
120- if flags.State {
121- // State includes database and caches
122- items = append(items, "database", "cache")
123+ if flags.BrowserCache {
124+ items = append(items, "browser-cache")
125+ }
126+ if flags.BrowserData {
127+ items = append(items, "browser-data")
123128 }
124- if flags.WebkitData {
125- items = append(items, "webkit-data")
129+ if flags.State {
130+ // State includes database and both caches
131+ items = append(items, "database", "history-cache", "browser-cache")
126132 }
127133 if flags.Config {
128134 items = append(items, "config")
@@ -154,24 +160,23 @@ func getPurgePaths(items []string) (map[string][]string, error) {
154160 }
155161 paths[item] = []string{dbPath}
156162
157- case "cache":
158- var cachePaths []string
159-
160- // WebKit cache
163+ case "history-cache":
161164 stateDir, err := config.GetStateDir()
162165 if err != nil {
163166 return nil, fmt.Errorf("failed to get state directory: %w", err)
164167 }
165- webkitCache := filepath.Join(stateDir, "webkit-cache")
166- cachePaths = append(cachePaths, webkitCache)
167-
168- // Dmenu fuzzy cache
169168 dmenuCache := filepath.Join(stateDir, "dmenu_fuzzy_cache.bin")
170- cachePaths = append(cachePaths, dmenuCache)
169+ paths[item] = []string{dmenuCache}
171170
172- paths[item] = cachePaths
171+ case "browser-cache":
172+ stateDir, err := config.GetStateDir()
173+ if err != nil {
174+ return nil, fmt.Errorf("failed to get state directory: %w", err)
175+ }
176+ webkitCache := filepath.Join(stateDir, "webkit-cache")
177+ paths[item] = []string{webkitCache}
173178
174- case "webkit-data":
179+ case "browser-data":
175180 dataDir, err := config.GetDataDir()
176181 if err != nil {
177182 return nil, fmt.Errorf("failed to get data directory: %w", err)
@@ -13,13 +13,14 @@ import (
13 13
14 // PurgeFlags holds all the purge command flags14 // PurgeFlags holds all the purge command flags
15 type PurgeFlags struct {15 type PurgeFlags struct {
16- Database bool16+ Database bool
17- Cache bool17+ HistoryCache bool
18- State bool18+ BrowserCache bool
19- WebkitData bool19+ BrowserData bool
20- Config bool20+ State bool
21- All bool21+ Config bool
22- Force bool22+ All bool
23+ Force bool
23 }24 }
24 25
25 // NewPurgeCmd creates the purge command26 // NewPurgeCmd creates the purge command
@@ -32,20 +33,21 @@ func NewPurgeCmd() *cobra.Command {
32 Long: `Purge various dumber data and cache files. By default, purges everything.33 Long: `Purge various dumber data and cache files. By default, purges everything.
33 34
34 Available purge targets:35 Available purge targets:
35- --database, -d Purge the SQLite database (history, shortcuts, zoom levels)36+ --database, -d Purge the SQLite database (history, shortcuts, zoom levels)
36- --cache, -c Purge WebKit cache and dmenu fuzzy search cache37+ --history-cache, -H Purge dmenu fuzzy search cache for history
37- --state, -s Purge all state data (includes database and caches)38+ --browser-cache, -c Purge WebKit browser cache (cached images, files, etc.)
38- --webkit-data, -w Purge WebKit data (cookies, local storage, session data)39+ --browser-data, -b Purge WebKit browser data (cookies, localStorage, sessionStorage)
39- --config Purge configuration files40+ --state, -s Purge all state data (includes database and caches)
40- --all, -a Purge everything (default if no specific flags are provided)41+ --config Purge configuration files
42+ --all, -a Purge everything (default if no specific flags are provided)
41 43
42 Use --force to skip the confirmation prompt.44 Use --force to skip the confirmation prompt.
43 45
44 Examples:46 Examples:
45 dumber purge # Purge everything (with confirmation)47 dumber purge # Purge everything (with confirmation)
46 dumber purge --force # Purge everything (no confirmation)48 dumber purge --force # Purge everything (no confirmation)
47- dumber purge -d -c # Purge only database and caches49+ dumber purge -d -H -c # Purge database and both caches
48- dumber purge --webkit-data -f # Force purge WebKit data only`,50+ dumber purge --browser-data -f # Force purge browser data only`,
49 RunE: func(_ *cobra.Command, _ []string) error {51 RunE: func(_ *cobra.Command, _ []string) error {
50 // Initialize CLI to get config paths52 // Initialize CLI to get config paths
51 cli, err := NewCLI()53 cli, err := NewCLI()
@@ -64,9 +66,10 @@ Examples:
64 66
65 // Add flags67 // Add flags
66 cmd.Flags().BoolVarP(&flags.Database, "database", "d", false, "Purge the SQLite database")68 cmd.Flags().BoolVarP(&flags.Database, "database", "d", false, "Purge the SQLite database")
67- cmd.Flags().BoolVarP(&flags.Cache, "cache", "c", false, "Purge WebKit cache and dmenu fuzzy cache")69+ cmd.Flags().BoolVarP(&flags.HistoryCache, "history-cache", "H", false, "Purge dmenu fuzzy search cache")
70+ cmd.Flags().BoolVarP(&flags.BrowserCache, "browser-cache", "c", false, "Purge WebKit browser cache")
71+ cmd.Flags().BoolVarP(&flags.BrowserData, "browser-data", "b", false, "Purge WebKit browser data (cookies, localStorage)")
68 cmd.Flags().BoolVarP(&flags.State, "state", "s", false, "Purge all state data")72 cmd.Flags().BoolVarP(&flags.State, "state", "s", false, "Purge all state data")
69- cmd.Flags().BoolVarP(&flags.WebkitData, "webkit-data", "w", false, "Purge WebKit data (cookies, local storage)")
70 cmd.Flags().BoolVar(&flags.Config, "config", false, "Purge configuration files")73 cmd.Flags().BoolVar(&flags.Config, "config", false, "Purge configuration files")
71 cmd.Flags().BoolVarP(&flags.All, "all", "a", false, "Purge everything")74 cmd.Flags().BoolVarP(&flags.All, "all", "a", false, "Purge everything")
72 cmd.Flags().BoolVarP(&flags.Force, "force", "f", false, "Skip confirmation prompt")75 cmd.Flags().BoolVarP(&flags.Force, "force", "f", false, "Skip confirmation prompt")
@@ -106,23 +109,26 @@ func determinePurgeItems(flags PurgeFlags) []string {
106 var items []string109 var items []string
107 110
108 // If no specific flags are set, or --all is set, purge everything111 // If no specific flags are set, or --all is set, purge everything
109- if flags.All || (!flags.Database && !flags.Cache && !flags.State && !flags.WebkitData && !flags.Config) {112+ if flags.All || (!flags.Database && !flags.HistoryCache && !flags.BrowserCache && !flags.BrowserData && !flags.State && !flags.Config) {
110- return []string{"database", "cache", "webkit-data", "config"}113+ return []string{"database", "history-cache", "browser-cache", "browser-data", "config"}
111 }114 }
112 115
113 // Add items based on flags116 // Add items based on flags
114 if flags.Database {117 if flags.Database {
115 items = append(items, "database")118 items = append(items, "database")
116 }119 }
117- if flags.Cache {120+ if flags.HistoryCache {
118- items = append(items, "cache")121+ items = append(items, "history-cache")
119 }122 }
120- if flags.State {123+ if flags.BrowserCache {
121- // State includes database and caches124+ items = append(items, "browser-cache")
122- items = append(items, "database", "cache")125+ }
126+ if flags.BrowserData {
127+ items = append(items, "browser-data")
123 }128 }
124- if flags.WebkitData {129+ if flags.State {
125- items = append(items, "webkit-data")130+ // State includes database and both caches
131+ items = append(items, "database", "history-cache", "browser-cache")
126 }132 }
127 if flags.Config {133 if flags.Config {
128 items = append(items, "config")134 items = append(items, "config")
@@ -154,24 +160,23 @@ func getPurgePaths(items []string) (map[string][]string, error) {
154 }160 }
155 paths[item] = []string{dbPath}161 paths[item] = []string{dbPath}
156 162
157- case "cache":163+ case "history-cache":
158- var cachePaths []string
159-
160- // WebKit cache
161 stateDir, err := config.GetStateDir()164 stateDir, err := config.GetStateDir()
162 if err != nil {165 if err != nil {
163 return nil, fmt.Errorf("failed to get state directory: %w", err)166 return nil, fmt.Errorf("failed to get state directory: %w", err)
164 }167 }
165- webkitCache := filepath.Join(stateDir, "webkit-cache")
166- cachePaths = append(cachePaths, webkitCache)
167-
168- // Dmenu fuzzy cache
169 dmenuCache := filepath.Join(stateDir, "dmenu_fuzzy_cache.bin")168 dmenuCache := filepath.Join(stateDir, "dmenu_fuzzy_cache.bin")
170- cachePaths = append(cachePaths, dmenuCache)169+ paths[item] = []string{dmenuCache}
171 170
172- paths[item] = cachePaths171+ case "browser-cache":
172+ stateDir, err := config.GetStateDir()
173+ if err != nil {
174+ return nil, fmt.Errorf("failed to get state directory: %w", err)
175+ }
176+ webkitCache := filepath.Join(stateDir, "webkit-cache")
177+ paths[item] = []string{webkitCache}
173 178
174- case "webkit-data":179+ case "browser-data":
175 dataDir, err := config.GetDataDir()180 dataDir, err := config.GetDataDir()
176 if err != nil {181 if err != nil {
177 return nil, fmt.Errorf("failed to get data directory: %w", err)182 return nil, fmt.Errorf("failed to get data directory: %w", err)

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