From 898b6369aa5d12967aade78e106bcc2f8153abe4 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Thu, 3 Oct 2019 11:31:25 -0400 Subject: [PATCH] Update helptext + download? --- cmdDownload.go | 9 +++++++-- cmdHelp.go | 2 +- cmdJoin.go | 2 +- cmdReact.go | 2 +- cmdStream.go | 5 ++--- cmdUploadFile.go | 2 +- main.go | 2 -- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmdDownload.go b/cmdDownload.go index acd062b..0f55de1 100644 --- a/cmdDownload.go +++ b/cmdDownload.go @@ -10,7 +10,7 @@ import ( func init() { command := Command{ Cmd: []string{"download", "d"}, - Description: "Download a file", + Description: "/d $messageId $fileName - Download a file to user's downloadpath", Help: "", Exec: cmdDownloadFile, } @@ -20,7 +20,12 @@ func init() { func cmdDownloadFile(cmd []string) { messageID, _ := strconv.Atoi(cmd[1]) - fileName := cmd[2] + var fileName string + if len(cmd) == 3 { + fileName = cmd[2] + } else { + fileName = "" + } chat := k.NewChat(channel) _, err := chat.Download(messageID, fmt.Sprintf("%s/%s", downloadPath, fileName)) diff --git a/cmdHelp.go b/cmdHelp.go index 755ae9b..d8d01d0 100644 --- a/cmdHelp.go +++ b/cmdHelp.go @@ -10,7 +10,7 @@ import ( func init() { command := Command{ Cmd: []string{"help", "h"}, - Description: "Show information about avaailable commands", + Description: "/h Show information about available commands", Help: "", Exec: cmdHelp, } diff --git a/cmdJoin.go b/cmdJoin.go index 7306862..d570bb8 100644 --- a/cmdJoin.go +++ b/cmdJoin.go @@ -11,7 +11,7 @@ import ( func init() { command := Command{ Cmd: []string{"join", "j"}, - Description: "Join a channel", + Description: "/j $team/user $channel - Join a chat, $user or $team $channel", Help: "", Exec: cmdJoin, } diff --git a/cmdReact.go b/cmdReact.go index 5bc07ab..d87607a 100644 --- a/cmdReact.go +++ b/cmdReact.go @@ -7,7 +7,7 @@ import "strconv" func init() { command := Command{ Cmd: []string{"react", "r", "+"}, - Description: "React to a message", + Description: "/r $messageId $reaction - React to a message (messageID is optional)", Help: "", Exec: cmdReact, } diff --git a/cmdStream.go b/cmdStream.go index dd4bc9d..de7eace 100644 --- a/cmdStream.go +++ b/cmdStream.go @@ -2,11 +2,10 @@ package main - func init() { command := Command{ - Cmd: []string{"stream", "s" }, - Description: "Stream all incoming messages", + Cmd: []string{"stream", "s"}, + Description: "/s - Stream all incoming messages", Help: "", Exec: cmdStream, } diff --git a/cmdUploadFile.go b/cmdUploadFile.go index 8ea3bc4..c7b6368 100644 --- a/cmdUploadFile.go +++ b/cmdUploadFile.go @@ -9,7 +9,7 @@ import ( func init() { command := Command{ Cmd: []string{"upload", "u"}, - Description: "Upload a file", + Description: "/u $filePath $fileName - Upload file with optional name", Help: "", Exec: cmdUploadFile, } diff --git a/main.go b/main.go index 98bc7a6..16c3246 100644 --- a/main.go +++ b/main.go @@ -110,8 +110,6 @@ func formatOutput(api keybase.ChatAPI) string { return ret } - - func populateList() { _, maxY := g.Size() if testVar, err := k.ChatList(); err != nil {