MCPcopy Index your code
hub / github.com/dearcode/candy / main

Function main

candy.go:404–456  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402}
403
404func main() {
405 c := candy.NewCandyClient("127.0.0.1:9000", &cmdClient{})
406 if err := c.Start(); err != nil {
407 log.Errorf("start client error:%s", err.Error())
408 return
409 }
410
411 running := true
412 reader := bufio.NewReader(os.Stdin)
413 for running {
414 notice()
415 data, _, _ := reader.ReadLine()
416 command := string(data)
417 if command == "" {
418 continue
419 }
420
421 log.Debugf("command:%v", command)
422 if command == "0" {
423 running = false
424 } else if command == "1" {
425 register(c, reader)
426 } else if command == "2" {
427 login(c, reader)
428 } else if command == "3" {
429 logout(c, reader)
430 } else if command == "4" {
431 updateUserInfo(c, reader)
432 } else if command == "5" {
433 getUserInfoByName(c, reader)
434 } else if command == "6" {
435 findUser(c, reader)
436 } else if command == "7" {
437 addFriend(c, reader)
438 } else if command == "8" {
439 newMessage(c, reader)
440 } else if command == "9" {
441 createGroup(c, reader)
442 } else if command == "10" {
443 loadGroupList(c, reader)
444 } else if command == "11" {
445 getUserInfoByID(c, reader)
446 } else if command == "12" {
447 loadFriendList(c, reader)
448 } else if command == "13" {
449 updateUserPasswd(c, reader)
450 } else if command == "14" {
451 confirmFriend(c, reader)
452 } else {
453 log.Errorf("未知命令")
454 }
455 }
456}

Callers

nothing calls this directly

Calls 15

StartMethod · 0.95
noticeFunction · 0.85
registerFunction · 0.85
loginFunction · 0.85
logoutFunction · 0.85
updateUserInfoFunction · 0.85
getUserInfoByNameFunction · 0.85
findUserFunction · 0.85
addFriendFunction · 0.85
newMessageFunction · 0.85
createGroupFunction · 0.85
loadGroupListFunction · 0.85

Tested by

no test coverage detected