Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inkel/cmd2slack
Execute a command and send its output to Slack
https://github.com/inkel/cmd2slack
cli devops devops-tools go golang slack slack-api
Last synced: 12 days ago
JSON representation
Execute a command and send its output to Slack
- Host: GitHub
- URL: https://github.com/inkel/cmd2slack
- Owner: inkel
- License: mit
- Created: 2017-03-02T17:56:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-03T14:38:04.000Z (about 7 years ago)
- Last Synced: 2024-08-01T22:44:06.094Z (4 months ago)
- Topics: cli, devops, devops-tools, go, golang, slack, slack-api
- Language: Go
- Size: 188 KB
- Stars: 20
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmd2slack - Execute a command and send its output to Slack
Execute a command and send its `stdout` and `stderr` to a Slack channel as an [Incoming Webhook](https://api.slack.com/incoming-webhooks).
## Usage
First you need to set up an [incoming webhook integration](https://my.slack.com/services/new/incoming-webhook/) in your Slack workspace. Once done that, you will receive a webhook URL (`$HOOK` hencefort). That's all the configuration you need.Once you have your webhook URL, just call your command prefixed by `cmd2slack`, like in the following example:
```
$ cmd2slack -hook $HOOK ping -c 5 google.com
```If the invocation was successful, you will receive a message like this:
![success](success.png)
If the command executed exits with a failure code, the message will look like this:
![failure](failure.png)
The are also additional flags you can pass the program:
```
$ cmd2slack --help
Usage of cmd2slack:
-channel string
Channel where to post the output
-emoji string
Emoji to use
-hook string
Slack Incoming Webhook URL
-icon string
URL of icon to use
-timing
Include command execution timing
-username string
Username
-verbose
Show command execution on screen
```## Installation
If you have a running Go environment, just do```
go install github.com/inkel/cmd2slack
```If you prefer instead downloading precompiled binaries, you can find them in the [releases](https://github.com/inkel/cmd2slack/releases) section. Just download the version you're looking for, place it in your `$PATH` and make it executable. Enjoy!
## License
MIT. See [LICENSE](LICENSE).