MCPcopy Index your code
hub / github.com/abiosoft/ishell / handleCommand

Method handleCommand

ishell.go:263–281  ·  view source on GitHub ↗
(str []string)

Source from the content-addressed store, hash-verified

261}
262
263func (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
283func (s *Shell) readLine() (line string, err error) {
284 consumer := make(chan lineString)

Callers 1

handleInputFunction · 0.80

Calls 4

newContextFunction · 0.85
FindCmdMethod · 0.80
PrintlnMethod · 0.65
HelpTextMethod · 0.65

Tested by

no test coverage detected