(cmd *cobra.Command)
| 94 | } |
| 95 | |
| 96 | func commandType(cmd *cobra.Command) string { |
| 97 | switch cmd.Name() { |
| 98 | case "tail": |
| 99 | return "stream" |
| 100 | case "search", "browse", "get", "list", "stats", "analyze", "describe", "schema", "open": |
| 101 | return "read" |
| 102 | case "create", "delete", "clear", "import", "update", "set", "save", "move", "copy", "crawl", "run", "pause", "reindex", "unblock", "remove", "add", "setdefault": |
| 103 | return "write" |
| 104 | default: |
| 105 | if cmd.HasAvailableSubCommands() { |
| 106 | return "namespace" |
| 107 | } |
| 108 | return "other" |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func getCommands(cmd *cobra.Command) []Command { |
| 113 | var commands []Command |