func showHelp(h *kh.Hand) { helpText := `The King's Hand (kh) is a tool for organizing and executing shellish scripts. It does your dirty work, so keep it clean. kh exposes plugins, known as fingers, as subcommands. Usage: kh [flags] kh [finger] [arguments to a finger] Available Meta-Commands: version Print the version number of King's Hand help C'mon, do I have to explain this one? update [finger] Builds one or more fingers By default, updates all Flags: -H, --hand-home="/Users/hitman/.kh": Home directory for kh -v, --verbose[=false]: verbose output Use "kh [finger] --help" for more information about a finger. ` fmt.Printf(helpText) if len(h.Fingers) > 0 { fmt.Printf("Available fingers are:\n%s\n", strings.Join(h.FingerNames(), "\n")) } else { fmt.Printf("Currently no fingers available\n") } }
func fingerInvoked(h *kh.Hand, arg string) bool { return kh.Contains(h.FingerNames(), arg) }
func fingerInvoked(h *kh.Hand, args []string) bool { if len(args) < 2 { return false } return kh.Contains(h.FingerNames(), args[1]) }