7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# 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')
if ARGV.size > 0
f.write ARGV.join(' ')
f.rewind
end
msg = begin
system "vim -S %s %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
|