(args []string, out io.Writer)
| 544 | } |
| 545 | |
| 546 | func 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 | |
| 585 | func printCommandHelp(name string, out io.Writer) bool { |
| 586 | switch name { |
no test coverage detected