Cleanup
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
4
main.go
4
main.go
@ -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)
|
||||
}
|
||||
|
||||
12
types.go
12
types.go
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user