Mercurial > mercurial > hgweb_golang.cgi
comparison src/gogemo/main.go @ 28:8e3f320396b8
compress dictionary.
| author | pyon@macmini |
|---|---|
| date | Sat, 09 Feb 2019 15:56:49 +0900 |
| parents | 3d6709f41037 |
| children | 0f05c342fde1 |
comparison
equal
deleted
inserted
replaced
| 27:3d6709f41037 | 28:8e3f320396b8 |
|---|---|
| 1 /* | 1 /* |
| 2 Gogemo: Command-line Migemo program by go. | 2 Gogemo: Command-line Migemo program by go. |
| 3 Last Change: 2019-02-03 Sun 19:45:42. | 3 Last Change: 2019-02-09 Sat 15:46:37. |
| 4 | 4 |
| 5 Written by T.Mutoh | 5 Written by T.Mutoh |
| 6 */ | 6 */ |
| 7 package main | 7 package main |
| 8 | 8 |
| 12 "os" | 12 "os" |
| 13 | 13 |
| 14 "./gogemo" | 14 "./gogemo" |
| 15 ) | 15 ) |
| 16 | 16 |
| 17 const ver string = "1.0" | 17 const ver string = "1.1" |
| 18 | 18 |
| 19 func main() { | 19 func main() { |
| 20 inv := flag.Bool("v", false, "inverse") | 20 inv := flag.Bool("v", false, "inverse (not implement)") |
| 21 wfn := flag.Bool("f", false, "with filename") | 21 wfn := flag.Bool("f", false, "with filename") |
| 22 look := flag.Bool("l", false, "lookup dictionary") | 22 look := flag.Bool("l", false, "lookup dictionary") |
| 23 // cnt := flag.Bool("c", false, "count matched") | 23 // cnt := flag.Bool("c", false, "count matched") |
| 24 // iu := flag.Bool("w", false, "input encoding: utf-8") | 24 // iu := flag.Bool("w", false, "input encoding: utf-8") |
| 25 // ou := flag.Bool("W", false, "output encoding: utf-8") | 25 // ou := flag.Bool("W", false, "output encoding: utf-8") |
| 30 var g gogemo.Gogemo | 30 var g gogemo.Gogemo |
| 31 g.SetOptions(*inv, *wfn) | 31 g.SetOptions(*inv, *wfn) |
| 32 | 32 |
| 33 switch flag.NArg() { | 33 switch flag.NArg() { |
| 34 case 0: | 34 case 0: |
| 35 fmt.Fprint( os.Stderr, "[ gogemo v" + ver + " ]\n") | 35 fmt.Fprint(os.Stderr, "[ gogemo v" + ver + " ]\n") |
| 36 flag.PrintDefaults() | 36 flag.PrintDefaults() |
| 37 fmt.Fprint(os.Stderr, "\n") | |
| 38 fmt.Fprint(os.Stderr, "> gogemo roma file1 file2...\n") | |
| 39 fmt.Fprint(os.Stderr, "> cat file | gogemo roma\n") | |
| 40 fmt.Fprint(os.Stderr, "> gogemo -l roma\n") | |
| 37 os.Exit(0) | 41 os.Exit(0) |
| 38 case 1: // from stdin or look dict | 42 case 1: // from stdin or look dict |
| 39 g.Prepare(flag.Arg(0), nil) | 43 g.Prepare(flag.Arg(0), nil) |
| 40 if *look { | 44 if *look { |
| 41 g.Look() | 45 g.Look() |
