Files
HackBrowserData/cmd/hack-browser-data/names.go
T
Roger bbd353f314 refactor: run every command on the pipeline (#665)
dump, dumpkeys, archive, restore, and list now run on the app stages, so cmd's old path goes away.
archive writes manifest.json and restore reads it, falling back to today's layout for older archives.
Windows and macOS smoke matched today's output apart from the planned changes.
2026-10-29 14:15:59 +08:00

40 lines
987 B
Go

package main
import (
"os"
"sort"
"strings"
"github.com/moond4rk/hackbrowserdata/internal/app"
"github.com/moond4rk/hackbrowserdata/internal/browser"
"github.com/moond4rk/hackbrowserdata/internal/category"
"github.com/moond4rk/hackbrowserdata/internal/log"
)
// browserNames lists this OS's browser IDs for the usage strings, sorted as they have always been listed.
func browserNames() string {
defs := browser.Supported()
ids := make([]string, 0, len(defs))
for _, d := range defs {
ids = append(ids, d.ID)
}
sort.Strings(ids)
return strings.Join(ids, "|")
}
func categoryNames() string {
all := category.All()
names := make([]string, len(all))
for i, c := range all {
names[i] = c.String()
}
return strings.Join(names, ",")
}
// report prints the run's summary; it is not part of the output, so failing to print it never fails the run.
func report(s app.Summary) {
if err := app.Report(os.Stderr, s); err != nil {
log.Warnf("print summary: %v", err)
}
}