bcicen/slackcat

CLI utility to post files and command output to slack

Go

1,222

191 commits

updated Jul 23, 2024

See the code

README

slackcat

Slackcat is a simple commandline utility to post snippets to Slack.

slackcat

Installing

Download the latest release for your platform:

curl -Lo slackcat https://github.com/bcicen/slackcat/releases/download/1.7.2/slackcat-1.7.2-$(uname -s)-amd64
sudo mv slackcat /usr/local/bin/
sudo chmod +x /usr/local/bin/slackcat

slackcat is also available via homebrew:

brew install slackcat

Building

To optionally build slackcat from source, ensure you have dep installed and run:

go get github.com/bcicen/slackcat && \
cd $GOPATH/src/github.com/bcicen/slackcat && \
make build

You must use GNU make for the build to work correctly. If your platform does not install GNU make as make (i.e. OpenBSD) then you will need to install gmake and run:

go get github.com/bcicen/slackcat && \
cd $GOPATH/src/github.com/bcicen/slackcat && \
gmake build

Configuration

Generate an initial config, or add a new team token with:

slackcat --configure

You'll be prompted for a team nickname and a new browser window will be opened for you to confirm the request via Slack. Provide the returned token to slackcat when prompted, and you're ready to go!

For configuring multiple teams and default channels, see Configuration Guide.

Usage

Pipe command output as a text snippet:

$ echo -e "hi\nthere" | slackcat --channel general --filename hello
*slackcat* file hello uploaded to general

Post an existing file:

$ slackcat --channel general /home/user/bot.png
*slackcat* file bot.png uploaded to general

Stream input continuously:

$ tail -F -n0 /path/to/log | slackcat --channel general --stream
*slackcat* posted 5 message lines to general
*slackcat* posted 2 message lines to general
...

Options

OptionDescription
--tee, -tPrint stdin to screen before posting
--stream, -sStream messages to Slack continuously instead of uploading a single snippet
--noopSkip posting file to Slack. Useful for testing
--configureConfigure Slackcat via oauth
--iconemoji, -iSpecify emoji icon for message (e.g. "👍")
--channel, -cSlack channel, group, or user to post to
--filename, -nFilename for upload. Defaults to given filename or current timestamp if reading from stdin
--filetypeSpecify filetype for syntax highlighting. Defaults to autodetect
--commentInitial comment for snippet
--usernameStream messages as given bot user. Defaults to auth user
--threadStream messages to thread after initial comment message
cli
commandline
slack
slackapi

bcicen/slackcat

CLI utility to post files and command output to slack

Go

1,222

191 commits

updated Jul 23, 2024

See the code

README

slackcat

Slackcat is a simple commandline utility to post snippets to Slack.

slackcat

Installing

Download the latest release for your platform:

curl -Lo slackcat https://github.com/bcicen/slackcat/releases/download/1.7.2/slackcat-1.7.2-$(uname -s)-amd64
sudo mv slackcat /usr/local/bin/
sudo chmod +x /usr/local/bin/slackcat

slackcat is also available via homebrew:

brew install slackcat

Building

To optionally build slackcat from source, ensure you have dep installed and run:

go get github.com/bcicen/slackcat && \
cd $GOPATH/src/github.com/bcicen/slackcat && \
make build

You must use GNU make for the build to work correctly. If your platform does not install GNU make as make (i.e. OpenBSD) then you will need to install gmake and run:

go get github.com/bcicen/slackcat && \
cd $GOPATH/src/github.com/bcicen/slackcat && \
gmake build

Configuration

Generate an initial config, or add a new team token with:

slackcat --configure

You'll be prompted for a team nickname and a new browser window will be opened for you to confirm the request via Slack. Provide the returned token to slackcat when prompted, and you're ready to go!

For configuring multiple teams and default channels, see Configuration Guide.

Usage

Pipe command output as a text snippet:

$ echo -e "hi\nthere" | slackcat --channel general --filename hello
*slackcat* file hello uploaded to general

Post an existing file:

$ slackcat --channel general /home/user/bot.png
*slackcat* file bot.png uploaded to general

Stream input continuously:

$ tail -F -n0 /path/to/log | slackcat --channel general --stream
*slackcat* posted 5 message lines to general
*slackcat* posted 2 message lines to general
...

Options

OptionDescription
--tee, -tPrint stdin to screen before posting
--stream, -sStream messages to Slack continuously instead of uploading a single snippet
--noopSkip posting file to Slack. Useful for testing
--configureConfigure Slackcat via oauth
--iconemoji, -iSpecify emoji icon for message (e.g. "👍")
--channel, -cSlack channel, group, or user to post to
--filename, -nFilename for upload. Defaults to given filename or current timestamp if reading from stdin
--filetypeSpecify filetype for syntax highlighting. Defaults to autodetect
--commentInitial comment for snippet
--usernameStream messages as given bot user. Defaults to auth user
--threadStream messages to thread after initial comment message
cli
commandline
slack
slackapi

Project health

Overall

2.3/10

Maintained

0/10

Code review

4/10
OpenSSF Scorecard

Latest release

v1.2.1 · Apr 25, 2017

Releases this year

0

Significant stargazers

Simon Cruanes

467 followers · starred Nov 2021

Juan Facorro

140 followers · starred Aug 2017

Kir Shatrov

508 followers · starred Jan 2016

Tatsunori Uchino

45 followers · starred Apr 2019