public
Rubygem
Description: command line tweets and an api wrapper for twitter
Homepage: http://twitter.rubyforge.org/
Clone URL: git://github.com/jnunemaker/twitter.git
Search Repo:
Click here to lend your support to: twitter and make a donation at www.pledgie.com !
Added #d command line functionality. Also, d now takes stdin for message.
jnunemaker (author)
Tue Jul 22 15:16:56 -0700 2008
commit  25ddfe33a10a252ff7d9ba74d4d16e3e25719661
tree    bcf78bc8fc98d2ba887115da465363b8d010d72d
parent  ad2da1676a38e3fd1b2c0d8ec581d9a220ec5889
...
1
2
3
 
4
5
6
7
 
 
 
 
 
8
9
10
11
...
1
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0
@@ -1,10 +1,15 @@
0
 #!/usr/bin/env ruby
0
 
0
-# if we have stdin, let's prepend it to the message
0
+# if we have stdin, let's prepend it to the message for post
0
 if ARGV[0] && ARGV[0] == 'post' && !STDIN.tty?
0
   ARGV[1] = "#{STDIN.read}#{ARGV[1]}"
0
 end
0
 
0
+# if we have stdin, let's prepend it to the message for d
0
+if ARGV[0] && ARGV[0] == 'd' && !STDIN.tty?
0
+ ARGV[2] = "#{STDIN.read}#{ARGV[2]}"
0
+end
0
+
0
 $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
0
 require 'twitter'
0
 require 'twitter/cli'
0
\ No newline at end of file
...
138
139
140
141
142
143
144
145
146
 
147
148
149
...
187
188
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
...
138
139
140
 
 
 
 
 
 
141
142
143
144
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
0
@@ -138,12 +138,7 @@ Main {
0
   mode 'post' do
0
     def run
0
       do_work do
0
- post = if ARGV.size > 1
0
- ARGV.join " "
0
- else
0
- ARGV.shift
0
- end
0
-
0
+ post = ARGV.size > 1 ? ARGV.join(" ") : ARGV.shift
0
         say "Sending twitter update"
0
         finished, status = false, nil
0
         progress_thread = Thread.new { until finished; print "."; $stdout.flush; sleep 0.5; end; }
0
@@ -187,4 +182,20 @@ Main {
0
       end
0
     end
0
   end
0
+
0
+ mode 'd' do
0
+ argument('username') {
0
+ required
0
+ description 'username or id of twitterrer to direct message'
0
+ }
0
+
0
+ def run
0
+ do_work do
0
+ username = params['username'].value
0
+ post = ARGV.size > 1 ? ARGV.join(" ") : ARGV.shift
0
+ base.d(username, post)
0
+ say "Direct message sent to #{username}"
0
+ end
0
+ end
0
+ end
0
 }

Comments

    No one has commented yet.