1
0
mirror of https://github.com/Rudi9719/kbtui.git synced 2026-03-22 08:47:24 +00:00
This commit is contained in:
Gregory Rudolph
2019-10-03 08:40:09 -04:00
parent c62aeb2b01
commit 3662c6e09d
5 changed files with 9 additions and 18 deletions

View File

@ -5,8 +5,6 @@ package main
import (
"fmt"
"sort"
"github.com/jroimartin/gocui"
)
func init() {
@ -20,7 +18,7 @@ func init() {
RegisterCommand(command)
}
func cmdHelp(g *gocui.Gui, cmd []string) {
func cmdHelp(cmd []string) {
var helpText string
if len(cmd) == 1 {
sort.Strings(baseCommands)

View File

@ -5,7 +5,6 @@ package main
import (
"fmt"
"github.com/jroimartin/gocui"
"samhofi.us/x/keybase"
)
@ -20,7 +19,7 @@ func init() {
RegisterCommand(command)
}
func cmdJoin(g *gocui.Gui, cmd []string) {
func cmdJoin(cmd []string) {
stream = false
if len(cmd) == 3 {
channel.MembersType = keybase.TEAM

View File

@ -4,8 +4,6 @@ package main
import (
"fmt"
"github.com/jroimartin/gocui"
)
func init() {
@ -19,7 +17,7 @@ func init() {
RegisterCommand(command)
}
func cmdUploadFile(g *gocui.Gui, cmd []string) {
func cmdUploadFile(cmd []string) {
filePath := cmd[1]
var fileName string
if len(cmd) == 3 {

View File

@ -352,7 +352,7 @@ func handleInput() error {
if strings.HasPrefix(inputString, cmdPrefix) {
cmd := strings.Split(inputString[len(cmdPrefix):], " ")
if c, ok := commands[cmd[0]]; ok {
c.Exec(g, cmd)
c.Exec(cmd)
return nil
} else if cmd[0] == "q" || cmd[0] == "quit" {
return gocui.ErrQuit
@ -395,5 +395,5 @@ func RegisterCommand(c Command) error {
// RunCommand calls a command as if it was run by the user
func RunCommand(c ...string) {
commands[c[0]].Exec(g, c)
commands[c[0]].Exec(c)
}

View File

@ -1,13 +1,9 @@
package main
import (
"github.com/jroimartin/gocui"
)
// Command outlines a command
type Command struct {
Cmd []string // Any aliases that trigger this command
Description string // A short description of the command
Help string // The full help text explaining how to use the command
Exec func(*gocui.Gui, []string) // A function that takes the command (arg[0]) and any arguments (arg[1:]) as input
Cmd []string // Any aliases that trigger this command
Description string // A short description of the command
Help string // The full help text explaining how to use the command
Exec func([]string) // A function that takes the command (arg[0]) and any arguments (arg[1:]) as input
}