From 10fe8ce609da9fc6b4e3c2de8555b5caa50f6e87 Mon Sep 17 00:00:00 2001
From: Sam <dxb@keybase.io>
Date: Fri, 4 Oct 2019 15:30:12 -0400
Subject: [PATCH] Show which type commands are loded

---
 cmdHelp.go       | 9 +++++++++
 tcmdAutoReact.go | 3 ++-
 types.go         | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/cmdHelp.go b/cmdHelp.go
index ea79855..0c9b1fa 100644
--- a/cmdHelp.go
+++ b/cmdHelp.go
@@ -5,6 +5,7 @@ package main
 import (
 	"fmt"
 	"sort"
+	"strings"
 )
 
 func init() {
@@ -20,11 +21,19 @@ func init() {
 
 func cmdHelp(cmd []string) {
 	var helpText string
+	var tCommands []string
 	if len(cmd) == 1 {
 		sort.Strings(baseCommands)
 		for _, c := range baseCommands {
 			helpText = fmt.Sprintf("%s%s%s\t\t%s\n", helpText, cmdPrefix, c, commands[c].Description)
 		}
+		if len(typeCommands) > 0 {
+			for c, _ := range typeCommands {
+				tCommands = append(tCommands, typeCommands[c].Name)
+			}
+			sort.Strings(tCommands)
+			helpText = fmt.Sprintf("%s\nThe following Type Commands are currently loaded: %s", helpText, strings.Join(tCommands, ", "))
+		}
 	}
 	printToView("Chat", helpText)
 }
diff --git a/tcmdAutoReact.go b/tcmdAutoReact.go
index 9d94aad..586c482 100644
--- a/tcmdAutoReact.go
+++ b/tcmdAutoReact.go
@@ -1,4 +1,4 @@
-// +build ignore
+// +ignore
 // +build type_commands autoreactcmd
 
 package main
@@ -10,6 +10,7 @@ import (
 func init() {
 	command := TypeCommand{
 		Cmd:         []string{"text"},
+		Name:        "AutoReact",
 		Description: "Automatically reacts to every incoming message with an emoji",
 		Exec:        tcmdAutoReact,
 	}
diff --git a/types.go b/types.go
index 18d9e73..77784e3 100644
--- a/types.go
+++ b/types.go
@@ -13,6 +13,7 @@ type Command struct {
 // TypeCommand outlines a command that reacts on message type
 type TypeCommand struct {
 	Cmd         []string              // Message types that trigger this command
+	Name        string                // The name of this command
 	Description string                // A short description of the command
 	Exec        func(keybase.ChatAPI) // A function that takes a raw chat message as input
 }