Skip to content

Commit

Permalink
found a better way to do stdin, no longer requiring extra gem dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Apr 3, 2008
1 parent 00a8573 commit 2ef6c3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.2.6 - April 2, 2008
* found a more simple way of doing stdin without any extra gem dependencies
0.2.5 - April 2, 2008
* Command line interface can now use stdin for posting (ideas and example code from Jeremy Friesen)
$ twitter post 'test without stdin' # => twitters: test without stdin
Expand Down
11 changes: 3 additions & 8 deletions bin/twitter
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,10 @@
require 'rubygems'
require 'twitter'
require 'twitter/command'
require 'timeout'

begin
timeout(1) do
if ARGV[0] && ARGV[0] == 'post'
ARGV[1] = "#{STDIN.read}#{ARGV[1]}"
end
end
rescue Timeout::Error
# if we have stdin, let's prepend it to the message
if ARGV[0] && ARGV[0] == 'post' && !STDIN.tty?
ARGV[1] = "#{STDIN.read}#{ARGV[1]}"
end

Twitter::Command.process!
2 changes: 1 addition & 1 deletion lib/twitter/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Twitter #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 2
TINY = 5
TINY = 6

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down

0 comments on commit 2ef6c3e

Please sign in to comment.