Browse Source

Cleanup

pull/1/head
Gregory Rudolph 5 years ago
parent
commit
3662c6e09d
  1. 4
      cmdHelp.go
  2. 3
      cmdJoin.go
  3. 4
      cmdUploadFile.go
  4. 4
      main.go
  5. 12
      types.go

4
cmdHelp.go

@ -5,8 +5,6 @@ package main @@ -5,8 +5,6 @@ package main
import (
"fmt"
"sort"
"github.com/jroimartin/gocui"
)
func init() {
@ -20,7 +18,7 @@ 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)

3
cmdJoin.go

@ -5,7 +5,6 @@ package main @@ -5,7 +5,6 @@ package main
import (
"fmt"
"github.com/jroimartin/gocui"
"samhofi.us/x/keybase"
)
@ -20,7 +19,7 @@ func init() { @@ -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
cmdUploadFile.go

@ -4,8 +4,6 @@ package main @@ -4,8 +4,6 @@ package main
import (
"fmt"
"github.com/jroimartin/gocui"
)
func init() {
@ -19,7 +17,7 @@ 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

@ -352,7 +352,7 @@ func handleInput() error { @@ -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 { @@ -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

@ -1,13 +1,9 @@ @@ -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
}

Loading…
Cancel
Save