Skip to content

Commit

Permalink
Merge pull request #169 from vim-jp/filter-channel-json
Browse files Browse the repository at this point in the history
Select log file in convert-exported-logs
  • Loading branch information
kuuote authored Oct 8, 2024
2 parents 72a4bb2 + 6c89593 commit 5915d74
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions subcmd/convert_exported_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"io"
"os"
"path/filepath"
"regexp"

cli "github.com/urfave/cli/v2"
"github.com/vim-jp/slacklog-generator/internal/slacklog"
Expand Down Expand Up @@ -138,8 +139,16 @@ func ReadAllMessages(inDir string) ([]*slacklog.Message, error) {
return nil, err
}

r, err := regexp.Compile(`\d{4}-\d{2}-\d{2}\.json`)
if err != nil {
return nil, err
}

var messages []*slacklog.Message
for _, name := range names {
if !r.MatchString(name) {
continue
}
var msgs []*slacklog.Message
err := slacklog.ReadFileAsJSON(filepath.Join(inDir, name), false, &msgs)
if err != nil {
Expand Down

0 comments on commit 5915d74

Please sign in to comment.