MCPcopy
hub / github.com/ph4ntonn/Stowaway / handleMainPanelCommand

Method handleMainPanelCommand

admin/cli/interactive_win.go:422–517  ·  view source on GitHub ↗

handle ur command

()

Source from the content-addressed store, hash-verified

420
421// handle ur command
422func (console *Console) handleMainPanelCommand() {
423 for {
424 tCommand := console.pretreatInput()
425
426 var fCommand []string
427 for _, command := range strings.Split(tCommand, " ") {
428 if command != "" {
429 fCommand = append(fCommand, command)
430 }
431 }
432
433 if len(fCommand) == 0 {
434 fCommand = append(fCommand, "")
435 }
436
437 switch fCommand[0] {
438 case "use":
439 if console.expectParams(fCommand, 2, MAIN, 1) {
440 break
441 }
442
443 uuidNum, _ := utils.Str2Int(fCommand[1])
444
445 if console.isOnline(uuidNum) {
446 console.nodeMode = true
447 console.status = fmt.Sprintf("(node %s) >> ", fCommand[1])
448 console.handleNodePanelCommand(uuidNum)
449 console.status = "(admin) >> "
450 console.nodeMode = false
451 } else {
452 printer.Fail("\r\n[*] Node %s doesn't exist!", fCommand[1])
453 }
454
455 console.ready <- true
456 case "detail":
457 if console.expectParams(fCommand, 1, MAIN, 0) {
458 break
459 }
460
461 task := &topology.TopoTask{
462 Mode: topology.SHOWDETAIL,
463 }
464
465 console.topology.TaskChan <- task
466 <-console.topology.ResultChan
467
468 console.ready <- true
469 case "topo":
470 if console.expectParams(fCommand, 1, MAIN, 0) {
471 break
472 }
473
474 task := &topology.TopoTask{
475 Mode: topology.SHOWTOPO,
476 }
477 console.topology.TaskChan <- task
478 <-console.topology.ResultChan
479

Callers 1

RunMethod · 0.95

Calls 6

pretreatInputMethod · 0.95
expectParamsMethod · 0.95
isOnlineMethod · 0.95
Str2IntFunction · 0.92
ShowMainHelpFunction · 0.85

Tested by

no test coverage detected