Skip to content

Commit 4c02613

Browse files
committed
fix missing files
1 parent 9a461cb commit 4c02613

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

cmd/unidecode/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/mozillazg/go-unidecode/cmd/unidecode
2+
3+
go 1.13
4+
5+
require (
6+
github.com/mattn/go-isatty v0.0.16
7+
github.com/mozillazg/go-unidecode v0.1.1
8+
)

cmd/unidecode/go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
2+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
3+
github.com/mozillazg/go-unidecode v0.1.1 h1:uiRy1s4TUqLbcROUrnCN/V85Jlli2AmDF6EeAXOeMHE=
4+
github.com/mozillazg/go-unidecode v0.1.1/go.mod h1:fYMdhyjni9ZeEmS6OE/GJHDLsF8TQvIVDwYR/drR26Q=
5+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
6+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

cmd/unidecode/main.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"io/ioutil"
7+
"os"
8+
"strings"
9+
10+
"github.com/mattn/go-isatty"
11+
"github.com/mozillazg/go-unidecode"
12+
)
13+
14+
func main() {
15+
version := flag.Bool("V", false, "Output version info")
16+
flag.Parse()
17+
if *version {
18+
v := unidecode.Version()
19+
fmt.Printf("unidecode %s\n", v)
20+
os.Exit(0)
21+
}
22+
23+
textSlice := flag.Args()
24+
stdin := []byte{}
25+
if !isatty.IsTerminal(os.Stdin.Fd()) {
26+
stdin, _ = ioutil.ReadAll(os.Stdin)
27+
}
28+
if len(stdin) > 0 {
29+
textSlice = append(textSlice, string(stdin))
30+
}
31+
32+
if len(textSlice) == 0 {
33+
fmt.Println("Usage: unidecode STRING")
34+
os.Exit(1)
35+
}
36+
37+
s := strings.Join(textSlice, " ")
38+
ret := unidecode.Unidecode(s)
39+
fmt.Println(ret)
40+
}

0 commit comments

Comments
 (0)