7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/twim.rb', line 7
def run
options = Twurl::CLI.parse_options ["/1/statuses/update.xml"]
vimscript = File.expand_path '../twim.vim', __FILE__
f = Tempfile.new('twitter-msg')
msg = begin
system %Q|vim -S %s -c "normal i#{ARGV.join(' ')}" %s| % [vimscript, f.path]
`cat #{f.path}`
ensure
f.close
end
msg = msg.strip.gsub(/\s+/, ' ')
if msg.empty?
puts "No tweet to post."
exit
end
puts "Posting update (%s characters):" % msg.length
puts msg
options.data['status'] = msg
Twurl::CLI.dispatch options
end
|