百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

slackcat

> 编程语言
开源

从命令行上传文件到 Slack 聊天。

326 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

从命令行上传文件到 Slack 聊天。

Slackcat

Upload files and snippets to Slack chat from the command-line.

Getting started

Log in to your slack.com account and get your API token from https://api.slack.com/.

bash
gem install slackcat
export SLACK_TOKEN=
echo 'hello world' | slackcat -c 

Note: since gem dependencies build extension modules, you may need ruby headers installed. For example, using system ruby on debian derivatives, you need to install the ruby-dev package.

Environment variables

  • SLACK_TOKEN: your token from https://api.slack.com/.
  • SLACK_CHANNEL: default destination channel; will be used if no -c, -g or -u option given

Command-line options

…

Basic usage: text snippets

To upload text snippets, slackcat is used similarly to unix cat: read data from STDIN or list filenames as arguments. Multiple files will be concatenated.

Examples:

bash
date | slackcat -c general
slackcat -u buddy foo.txt bar.txt

Uploads to slack are private by default. If you list channels, groups or usernames, content will be shared to them.

Multipart file uploads

If you wish to upload binary files, for example images, use the -m option, which will cause each file to be uploaded separately.

Example:

bash
slackcat -c general -m kitten.jpg cat.gif

Slack does a good job of setting filetype correctly from mimetype, though you may override this with the -t option.

This mode does not read stdin.

Post messages as chat text

To post text as a normal chat, instead of as a text snippet, use the -p option.

Example:

bash
date | slackcat -c general -p
slackcat -u buddy -p foo.txt bar.txt

Due to a limitation of the slack api you may also pass only one channel, group or username.

Example usage from vim

Upload contents of buffer:

:%! slackcat -c dev

Example usage from emacs

Upload contents of region:

M-| slackcat -c dev

To make a named function:

lisp
(setenv "SLACK_TOKEN" "")

(defvar slackcat-bin  "slackcat" "Command to invoke slackcat.")
(defvar slackcat-args "-c dev"   "Default arguments to pass to slackcat.")

(defun slackcat (&optional b e)
  "Upload contents of region to slack chat."
  (interactive "r")
  (let ((args (read-from-minibuffer "slackcat args: " slackcat-args)))
    (shell-command-on-region b e (format "%s %s" slackcat-bin args))))

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言