slackcat 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -1
- data/bin/slackcat +4 -1
- data/lib/slackcat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe79753317eb5e517f34405ac2eacc8d1519a21
|
4
|
+
data.tar.gz: 569adcfea88901c9934564de2b4da741f16098b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74832a42654ce15a7e5a8d0cce85a4ef5b990663f024bec479c71b5998fdc211a2d9a990a0ee641773f0814877c6cad2f4991bca061ed594ca5663aa7f4e1c4c
|
7
|
+
data.tar.gz: 9b6787dc0e4efb41972f5accec14a63d45debb56f19fe863925478021de3a9d35990a9cf35a7d01a958ffaf5df0f5a33227c8c980fadd7fab90e82a65784010c
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ command-line.
|
|
8
8
|
Log in to your slack.com account and get your API token from
|
9
9
|
https://api.slack.com/.
|
10
10
|
|
11
|
-
gem install
|
11
|
+
gem install slackcat
|
12
12
|
export SLACKCAT_TOKEN=<your api token>
|
13
13
|
echo 'hello world' | slackcat -c <channel>
|
14
14
|
|
@@ -37,3 +37,27 @@ Command-line options:
|
|
37
37
|
|
38
38
|
File uploads to slack are private by default. If you list channels,
|
39
39
|
content will be shared to them.
|
40
|
+
|
41
|
+
## Example usage from vim
|
42
|
+
|
43
|
+
Upload contents of buffer:
|
44
|
+
|
45
|
+
`:%! slackcat`
|
46
|
+
|
47
|
+
## Example usage from emacs
|
48
|
+
|
49
|
+
Upload contents of region:
|
50
|
+
|
51
|
+
`M-| slackcat`
|
52
|
+
|
53
|
+
To make a named function:
|
54
|
+
|
55
|
+
```lisp
|
56
|
+
(setenv "SLACK_TOKEN" "<your api token>")
|
57
|
+
(setenv "SLACK_CHANNELS" "<channel list")
|
58
|
+
|
59
|
+
(defun slackcat (&optional b e)
|
60
|
+
"Upload contents of region to slack chat."
|
61
|
+
(interactive "r")
|
62
|
+
(shell-command-on-region b e "slackcat"))
|
63
|
+
```
|
data/bin/slackcat
CHANGED
@@ -32,10 +32,13 @@ opts = Trollop::options do
|
|
32
32
|
opt :channels, 'Channels to share into', type: :string, short: 'c', default: ENV.fetch('SLACK_CHANNELS', nil)
|
33
33
|
opt :filetype, 'File type identifier', type: :string, short: 't'
|
34
34
|
opt :title, 'Title of file', type: :string, short: 'T'
|
35
|
-
opt :filename, 'Filename of file', type: :string, short: 'n'
|
35
|
+
opt :filename, 'Filename of file', type: :string, short: 'n'
|
36
36
|
opt :initial_comment, 'Initial comment to add', type: :string, short: 'i'
|
37
37
|
end
|
38
38
|
|
39
|
+
## get this after opts parsed out of ARGV
|
40
|
+
opts[:filename] ||= ARGV.first
|
41
|
+
|
39
42
|
raise 'set slack API token using SLACK_TOKEN or -k option' unless opts[:token]
|
40
43
|
slack = Slackcat.new(opts[:token])
|
41
44
|
|
data/lib/slackcat/version.rb
CHANGED