27
|
1 /*
|
|
2 Gogemo: Command-line Migemo program by go.
|
28
|
3 Last Change: 2019-02-09 Sat 15:46:37.
|
27
|
4
|
|
5 Written by T.Mutoh
|
|
6 */
|
|
7 package main
|
|
8
|
|
9 import (
|
|
10 "flag"
|
|
11 "fmt"
|
|
12 "os"
|
|
13
|
|
14 "./gogemo"
|
|
15 )
|
|
16
|
28
|
17 const ver string = "1.1"
|
27
|
18
|
|
19 func main() {
|
28
|
20 inv := flag.Bool("v", false, "inverse (not implement)")
|
27
|
21 wfn := flag.Bool("f", false, "with filename")
|
|
22 look := flag.Bool("l", false, "lookup dictionary")
|
|
23 // cnt := flag.Bool("c", false, "count matched")
|
|
24 // iu := flag.Bool("w", false, "input encoding: utf-8")
|
|
25 // ou := flag.Bool("W", false, "output encoding: utf-8")
|
|
26 // is := flag.Bool("s", false, "output encoding: shift-jis")
|
|
27 // os := flag.Bool("S", false, "output encoding: shift-jis")
|
|
28 flag.Parse()
|
|
29
|
|
30 var g gogemo.Gogemo
|
|
31 g.SetOptions(*inv, *wfn)
|
|
32
|
|
33 switch flag.NArg() {
|
|
34 case 0:
|
28
|
35 fmt.Fprint(os.Stderr, "[ gogemo v" + ver + " ]\n")
|
27
|
36 flag.PrintDefaults()
|
28
|
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")
|
27
|
41 os.Exit(0)
|
|
42 case 1: // from stdin or look dict
|
|
43 g.Prepare(flag.Arg(0), nil)
|
|
44 if *look {
|
|
45 g.Look()
|
|
46 os.Exit(0)
|
|
47 }
|
|
48 default:
|
|
49 g.Prepare(flag.Arg(0), flag.Args()[1:])
|
|
50 }
|
|
51
|
|
52 g.Search()
|
|
53 }
|
|
54
|