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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9530df0f2adb06a122bb7533813c0dadca7ebffa
4
- data.tar.gz: 55b338f3cc37f0c57a3bb6e54bbb2ab64aae19d2
3
+ metadata.gz: efe79753317eb5e517f34405ac2eacc8d1519a21
4
+ data.tar.gz: 569adcfea88901c9934564de2b4da741f16098b5
5
5
  SHA512:
6
- metadata.gz: 1804f2af8432e1b50bcc28be73cecf6e89167e7c7abdbeb38d94d3811f60f923e852c9aa9c8169bffd7aedf613d1ec522ada2bf8b6945e7930289db946c6445e
7
- data.tar.gz: 87464836bb03c29f4f28964964b5f8340bdfe74a897d1fdfa5e7260ce7052d3072db19d5e89256249794ba129876142e9a2a981076e76f32e802186612e36572
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'slackcat
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', default: ARGV.first
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
 
@@ -1,3 +1,3 @@
1
1
  module Slackcat
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lister