docs: trim code comments to the why (#676)

Comments that restated names or narrated the code are gone, and multi-line ones are cut to a line of why.
Only comments change: each edited Go file has the same token stream as before. winapi and abe come later.
This commit is contained in:
Roger authored and GitHub committed 2026-11-02 00:03:03 +08:00
1 parent 4e98ba7884
commit 0ed920f846
130 files changed
+201 -869

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
)
// setHome points the commands' home directory at a fixture: HOME, and USERPROFILE, which Windows reads instead.
// Windows reads USERPROFILE rather than HOME, so both point at the fixture.
func setHome(t *testing.T, home string) {
t.Helper()
t.Setenv("HOME", home)
+1 -3
View File
@@ -36,9 +36,7 @@ GitHub: https://github.com/moonD4rk/HackBrowserData`,
dump := dumpCmd()
root.AddCommand(dump, dumpKeysCmd(), archiveCmd(), restoreCmd(), listCmd(), versionCmd())
// Default to dump when no subcommand is given.
// Copy dump flags to root so that `hack-browser-data -b chrome`
// works the same as `hack-browser-data dump -b chrome`.
// Without a subcommand the root runs dump, as v1.1.0 did, so it carries dump's flags too.
root.RunE = func(cmd *cobra.Command, args []string) error {
dump.SetContext(cmd.Context())
return dump.RunE(dump, args)
+1 -2
View File
@@ -12,8 +12,7 @@ import (
"github.com/moond4rk/hackbrowserdata/internal/winapi"
)
// configureDoubleClickMode hides the console and bypasses cobra's
// double-click guard when launched from Explorer (issue #344).
// configureDoubleClickMode lets a double-click from Explorer run the tool with its console hidden (issue #344).
func configureDoubleClickMode() {
if !mousetrap.StartedByExplorer() {
return
-2
View File
@@ -69,8 +69,6 @@ func runRestore(ctx context.Context, stderr io.Writer, f app.RestoreFlags) error
return err
}
// openRestoreData returns the snapshot directory restore reads from: --data-dir in place, or --data-zip extracted
// into a temporary one.
func openRestoreData(dataDir, dataZip string) (*snapshot.Dir, error) {
if dataDir != "" {
return snapshot.Open(dataDir), nil