feat: update to 0.2.7, change default output to csv

pull/83/head
moond4rk 4 years ago committed by ᴍᴏᴏɴD4ʀᴋ
parent 28f8fb5497
commit b5ec1e89e6
  1. 2
      cmd/cmd.go
  2. 12
      core/data/parse.go

@ -29,7 +29,7 @@ func Execute() {
&cli.BoolFlag{Name: "compress", Aliases: []string{"cc"}, Destination: &compress, Value: false, Usage: "Compress result to zip"}, &cli.BoolFlag{Name: "compress", Aliases: []string{"cc"}, Destination: &compress, Value: false, Usage: "Compress result to zip"},
&cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browser, Value: "all", Usage: "Available browsers: all|" + strings.Join(core.ListBrowser(), "|")}, &cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browser, Value: "all", Usage: "Available browsers: all|" + strings.Join(core.ListBrowser(), "|")},
&cli.StringFlag{Name: "results-dir", Aliases: []string{"dir"}, Destination: &exportDir, Value: "results", Usage: "Export dir"}, &cli.StringFlag{Name: "results-dir", Aliases: []string{"dir"}, Destination: &exportDir, Value: "results", Usage: "Export dir"},
&cli.StringFlag{Name: "format", Aliases: []string{"f"}, Destination: &outputFormat, Value: "json", Usage: "Format, csv|json|console"}, &cli.StringFlag{Name: "format", Aliases: []string{"f"}, Destination: &outputFormat, Value: "csv", Usage: "Format, csv|json|console"},
}, },
HideHelpCommand: true, HideHelpCommand: true,
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {

@ -145,7 +145,7 @@ func (b *bookmarks) FirefoxParse() error {
) )
err = bookmarkRows.Scan(&id, &fk, &bType, &dateAdded, &title) err = bookmarkRows.Scan(&id, &fk, &bType, &dateAdded, &title)
if err != nil { if err != nil {
log.Error(err) log.Warn(err)
} }
if url, ok := tempMap[id]; ok { if url, ok := tempMap[id]; ok {
bookmarkUrl = url bookmarkUrl = url
@ -245,7 +245,7 @@ func (c *cookies) ChromeParse(secretKey []byte) error {
value, err = decrypt.ChromePass(secretKey, encryptValue) value, err = decrypt.ChromePass(secretKey, encryptValue)
} }
if err != nil { if err != nil {
log.Error(err) log.Debug(err)
} }
cookie.Value = string(value) cookie.Value = string(value)
c.cookies[host] = append(c.cookies[host], cookie) c.cookies[host] = append(c.cookies[host], cookie)
@ -407,7 +407,7 @@ func (h *historyData) FirefoxParse() error {
) )
err = historyRows.Scan(&id, &url, &visitDate, &title, &visitCount) err = historyRows.Scan(&id, &url, &visitDate, &title, &visitCount)
if err != nil { if err != nil {
log.Error(err) log.Warn(err)
} }
h.history = append(h.history, history{ h.history = append(h.history, history{
Title: title, Title: title,
@ -433,14 +433,14 @@ func (h *historyData) OutPut(format, browser, dir string) error {
return h.history[i].VisitCount > h.history[j].VisitCount return h.history[i].VisitCount > h.history[j].VisitCount
}) })
switch format { switch format {
case "json": case "csv":
err := h.outPutJson(browser, dir) err := h.outPutCsv(browser, dir)
return err return err
case "console": case "console":
h.outPutConsole() h.outPutConsole()
return nil return nil
default: default:
err := h.outPutCsv(browser, dir) err := h.outPutJson(browser, dir)
return err return err
} }
} }

Loading…
Cancel
Save