Skip to content

Commit

Permalink
update --list output
Browse files Browse the repository at this point in the history
  • Loading branch information
bcicen committed Oct 12, 2018
1 parent 79596c8 commit 4873d6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ func main() {
fileType := c.String("filetype")
fileComment := c.String("comment")

if c.Bool("list") {
for teamName, token := range config.Teams {
InitAPI(token)
for _, n := range listChannels() {
fmt.Printf("[%s] [channel] %s\n", teamName, n)
}
for _, n := range listGroups() {
fmt.Printf("[%s] [group] %s\n", teamName, n)
}
for _, n := range listIms() {
fmt.Printf("[%s] [im] %s\n", teamName, n)
}
}
os.Exit(0)
}

token := config.Teams[team]
if token == "" {
exitErr(fmt.Errorf("no such team: %s", team))
Expand All @@ -167,22 +183,6 @@ func main() {
InitAPI(token)
slackcat := newSlackcat(username, iconEmoji, channel)

if c.Bool("list") {
fmt.Println("channels:")
for _, n := range listChannels() {
fmt.Printf(" %s\n", n)
}
fmt.Println("groups:")
for _, n := range listGroups() {
fmt.Printf(" %s\n", n)
}
fmt.Println("ims:")
for _, n := range listIms() {
fmt.Printf(" %s\n", n)
}
os.Exit(0)
}

if len(c.Args()) > 0 {
if c.Bool("stream") {
output("filepath provided, ignoring stream option")
Expand Down
2 changes: 1 addition & 1 deletion slackcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (sc *Slackcat) postFile(filePath, fileName, fileType, fileComment string) {
}

start := time.Now()
_, err := api.FilesUpload(&slack.FilesUploadOpt{
err := api.FilesUpload(&slack.FilesUploadOpt{
Filepath: filePath,
Filename: fileName,
Filetype: fileType,
Expand Down

0 comments on commit 4873d6b

Please sign in to comment.