1
0
mirror of https://github.com/Rudi9719/kbtui.git synced 2026-03-22 09:57:24 +00:00

Add baseCommands

This commit is contained in:
Sam
2019-10-03 00:35:33 -04:00
parent 988035e346
commit 8266c1f6e7

View File

@ -14,6 +14,7 @@ import (
const cmdPrefix = "/" const cmdPrefix = "/"
var commands = make(map[string]Command) var commands = make(map[string]Command)
var baseCommands = make([]string)
// Configurable section // Configurable section
var downloadPath = "/tmp/" var downloadPath = "/tmp/"
@ -391,8 +392,11 @@ func quit(g *gocui.Gui, v *gocui.View) error {
// RegisterCommand registers a command to be used within the client // RegisterCommand registers a command to be used within the client
func RegisterCommand(c Command) error { func RegisterCommand(c Command) error {
var notAdded string var notAdded string
for _, cmd := range c.Cmd { for i, cmd := range c.Cmd {
if _, ok := commands[cmd]; !ok { if _, ok := commands[cmd]; !ok {
if i == 0 {
baseCommands = append(baseCommands, cmd)
}
commands[cmd] = c commands[cmd] = c
continue continue
} }