slack-cli icon indicating copy to clipboard operation
slack-cli copied to clipboard

Feature request: Ability to add snippets

Open wsturgiss opened this issue 7 years ago • 9 comments

Once a block of text exceeds 3978 characters it can't be fit into a single message and needs to be made into a snippet. Request to add ability to create snippets using a piped in block of text in the CLI.

wsturgiss avatar Dec 20 '18 15:12 wsturgiss

I'd like to work on this if you don't mind. Would be a fun first foray into python.

wsturgiss avatar Dec 20 '18 15:12 wsturgiss

Sounds good! Creating a snippet is pretty much like uploading a file, except that you need to call the upload API method with a content parameter instead of a file: https://api.slack.com/methods/files.upload

As for the CLI argument, maybe we can use the -F/--snippet? What do you think?

regisb avatar Dec 20 '18 15:12 regisb

I like the --snippet, but I'm not sure what the idea was on the -F. With Christmas over I will finally have some time to try this.

wsturgiss avatar Dec 27 '18 15:12 wsturgiss

take your time :)

I'm not sure what the idea was on the -F

It's just that most options can be specified in two forms: short and long. For instance: -f and --file both work for uploading a file.

regisb avatar Dec 27 '18 17:12 regisb

ah okay. Too bad -s is already taken. Maybe -C for code? Not really consistent with Slack though because code is just text inside triple ticks

wsturgiss avatar Dec 27 '18 19:12 wsturgiss

Well, a snippet is a kind of file, and file is -f/--file, so I think -F/--snippet makes sense. Or just --snippet (no short form).

regisb avatar Dec 27 '18 22:12 regisb

I would love this but please do have a short form. Also, if possible, allow us to specify what syntax highlighting to use.

genebean avatar Jan 08 '19 15:01 genebean

Apparently it's possible to specify a filetype parameter. But @genebean do you often upload a file with an extension that differs from its true nature? For instance, pretty much all python files have a .py extension.

regisb avatar Jan 08 '19 16:01 regisb

Good point. It would still be useful when piping input from standard in though.

Sent with GitHawk

genebean avatar Jan 08 '19 19:01 genebean