refactor: introduce category, record, and export packages (#651)

Later layers speak categories and records, and export needs nothing else.
Ordering rows once in the exporter fixes Firefox history, written least visited first.
This commit is contained in:
Roger authored and GitHub committed 2026-10-26 19:55:19 +08:00
1 parent 9937dbf9fb
commit b04c436a73
97 files changed
+1993 -1646

No files matched your search

+4 -4
View File
@@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
"github.com/moond4rk/hackbrowserdata/browser"
"github.com/moond4rk/hackbrowserdata/types"
"github.com/moond4rk/hackbrowserdata/internal/category"
)
func listCmd() *cobra.Command {
@@ -54,16 +54,16 @@ func printDetail(out io.Writer, browsers []browser.Browser) error {
// Build header: Browser Profile Password Cookie ...
w := tabwriter.NewWriter(out, 0, 0, 3, ' ', 0)
fmt.Fprint(w, "Browser\tProfile")
for _, c := range types.AllCategories {
for _, c := range category.All() {
fmt.Fprintf(w, "\t%s", c.String())
}
fmt.Fprintln(w)
for _, b := range browsers {
results, _ := b.CountEntries(types.AllCategories)
results, _ := b.CountEntries(category.All())
for _, r := range results {
fmt.Fprintf(w, "%s\t%s", b.BrowserName(), r.Name)
for _, c := range types.AllCategories {
for _, c := range category.All() {
fmt.Fprintf(w, "\t%d", r.Counts[c])
}
fmt.Fprintln(w)