(str []string)
| 261 | } |
| 262 | |
| 263 | func (s *Shell) handleCommand(str []string) (bool, error) { |
| 264 | if s.ignoreCase { |
| 265 | for i := range str { |
| 266 | str[i] = strings.ToLower(str[i]) |
| 267 | } |
| 268 | } |
| 269 | cmd, args := s.rootCmd.FindCmd(str) |
| 270 | if cmd == nil { |
| 271 | return false, nil |
| 272 | } |
| 273 | // trigger help if func is not registered or auto help is true |
| 274 | if cmd.Func == nil || (s.autoHelp && len(args) == 1 && args[0] == "help") { |
| 275 | s.Println(cmd.HelpText()) |
| 276 | return true, nil |
| 277 | } |
| 278 | c := newContext(s, cmd, args) |
| 279 | cmd.Func(c) |
| 280 | return true, c.err |
| 281 | } |
| 282 | |
| 283 | func (s *Shell) readLine() (line string, err error) { |
| 284 | consumer := make(chan lineString) |
no test coverage detected