File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,31 @@ func main() {
8787 }
8888 }
8989 case 1 < numberOfCandidate :
90- fmt .Printf ("There's %d candidates found\n " , len (candidates ))
91-
92- for _ , item := range candidates {
93- fmt .Printf ("\t %s\n " , item )
90+ // 完全一致するものがあるか?
91+ isPerfectMatchFound := false
92+ for _ , c := range candidates {
93+ if c == userInput {
94+ if v , ok := mapping [c ]; ok {
95+ fmt .Printf ("[Name] %q\n " , userInput )
96+ if err := v (); err != nil {
97+ log .Fatal (err )
98+ }
99+ }
100+
101+ isPerfectMatchFound = true
102+ break
103+ }
94104 }
95105
96- goto nextinput
106+ if ! isPerfectMatchFound {
107+ fmt .Printf ("There's %d candidates found\n " , len (candidates ))
108+
109+ for _ , item := range candidates {
110+ fmt .Printf ("\t %s\n " , item )
111+ }
112+
113+ goto nextinput
114+ }
97115 }
98116
99117 if * onetime {
You can’t perform that action at this time.
0 commit comments