Browse Source

Add baseCommands

pull/1/head
Sam 5 years ago
parent
commit
8266c1f6e7
  1. 6
      main.go

6
main.go

@ -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
} }

Loading…
Cancel
Save