Skip to content

Commit

Permalink
Able to suppress logs, closes #16 (#22)
Browse files Browse the repository at this point in the history
* - try to add SkipLog feature

* - fix nil pointer dereference
  • Loading branch information
suntong authored Oct 12, 2020
1 parent 22b7fd4 commit c1449e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/go-ego/gpy
go 1.13

require (
github.com/go-ego/gse v0.60.0
github.com/go-ego/gse v0.62.0
github.com/vcaesar/tt v0.10.1
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ github.com/go-ego/cedar v0.10.1 h1:zv0mqL1ZDnQrYco1p+CIZZwYO7UF07ponW9a51PUij0=
github.com/go-ego/cedar v0.10.1/go.mod h1:8PerMCSjZ4DLzBNxWTcvvhUops+zXeeGGGA9a1bgvlA=
github.com/go-ego/gse v0.60.0 h1:ZX9GyTzqy9NWMesQ0ItJ7Kj0NvV9oZzA2F9NFMNoi/Y=
github.com/go-ego/gse v0.60.0/go.mod h1:ShrS1GY+mkTMNSay65Ya/AIkguGM2tVmkDYcwOKPT6o=
github.com/go-ego/gse v0.62.0 h1:HHfnB0wWOixItVxtQmDIoQbPpoPBToS1T8cBIt98p0U=
github.com/go-ego/gse v0.62.0/go.mod h1:ShrS1GY+mkTMNSay65Ya/AIkguGM2tVmkDYcwOKPT6o=
github.com/vcaesar/tt v0.10.1 h1:0DEl+XkyXivEwb/7jIYhDQ1g7KtMYqD/ZqABcMwC3wo=
github.com/vcaesar/tt v0.10.1/go.mod h1:GHPxQYhn+7OgKakRusH7KJ0M5MhywoeLb8Fcffs/Gtg=
1 change: 1 addition & 0 deletions tools/pinyin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
github.com/go-ego/gpy v0.40.0
github.com/go-ego/gse v0.62.0
github.com/mattn/go-isatty v0.0.12
golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 // indirect
)
2 changes: 2 additions & 0 deletions tools/pinyin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/go-ego/gpy v0.40.0 h1:aFti81H7yHscHaYKy2Y8WA5lZZpQTGHMfMvJeT0og30=
github.com/go-ego/gpy v0.40.0/go.mod h1:4Sgx8WtGDGUUSoCq5Cs5Y6egUbLLZ4gZ7vrfR9FbWIY=
github.com/go-ego/gse v0.60.0 h1:ZX9GyTzqy9NWMesQ0ItJ7Kj0NvV9oZzA2F9NFMNoi/Y=
github.com/go-ego/gse v0.60.0/go.mod h1:ShrS1GY+mkTMNSay65Ya/AIkguGM2tVmkDYcwOKPT6o=
github.com/go-ego/gse v0.62.0 h1:HHfnB0wWOixItVxtQmDIoQbPpoPBToS1T8cBIt98p0U=
github.com/go-ego/gse v0.62.0/go.mod h1:ShrS1GY+mkTMNSay65Ya/AIkguGM2tVmkDYcwOKPT6o=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/vcaesar/tt v0.10.1 h1:0DEl+XkyXivEwb/7jIYhDQ1g7KtMYqD/ZqABcMwC3wo=
Expand Down
9 changes: 8 additions & 1 deletion tools/pinyin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/go-ego/gpy"
"github.com/go-ego/gpy/phrase"
"github.com/go-ego/gse"
"github.com/mattn/go-isatty"
)

Expand Down Expand Up @@ -67,7 +68,13 @@ func main() {
if Opts.Phrase {
phrase.Option = args

pys := phrase.Paragraph(ps)
var seg gse.Segmenter
if !Opts.Verbose {
seg.SkipLog = true
}

seg.LoadDict()
pys := phrase.Paragraph(ps, seg)
fmt.Println(pys)
return
}
Expand Down

0 comments on commit c1449e7

Please sign in to comment.