MCPcopy Index your code
hub / github.com/nikivdev/go / handleTopLevel

Function handleTopLevel

cli/flow/main.go:546–583  ·  view source on GitHub ↗
(args []string, out io.Writer)

Source from the content-addressed store, hash-verified

544}
545
546func handleTopLevel(args []string, out io.Writer) bool {
547 if len(args) == 0 {
548 printRootHelp(out)
549 return true
550 }
551
552 switch args[0] {
553 case "--help", "-h", "h":
554 printRootHelp(out)
555 return true
556 case "--version":
557 fmt.Fprintln(out, flowVersion)
558 return true
559 case "help":
560 if len(args) == 1 {
561 printRootHelp(out)
562 return true
563 }
564 if printCommandHelp(args[1], out) {
565 return true
566 }
567 fmt.Fprintf(out, "Unknown help topic %q\n", args[1])
568 return true
569 }
570
571 if len(args) > 1 {
572 last := args[len(args)-1]
573 if last == "--help" || last == "-h" {
574 if printCommandHelp(args[0], out) {
575 return true
576 }
577 printRootHelp(out)
578 return true
579 }
580 }
581
582 return false
583}
584
585func printCommandHelp(name string, out io.Writer) bool {
586 switch name {

Callers 1

mainFunction · 0.70

Calls 2

printRootHelpFunction · 0.70
printCommandHelpFunction · 0.70

Tested by

no test coverage detected