Class: Bbiff::Show
- Inherits:
-
Object
- Object
- Bbiff::Show
- Defined in:
- lib/bbiff/show.rb
Defined Under Namespace
Classes: UsageError
Constant Summary collapse
- NOTIFY_SEND =
'notify-send'
Instance Method Summary collapse
Instance Method Details
#main ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bbiff/show.rb', line 13 def main if ARGV.size != 2 raise UsageError end title = ARGV[0] post = Bbs::Post.from_s(ARGV[1]) notify_send = ENV['BBIFF_NOTIFY_SEND'] || (`which #{NOTIFY_SEND}` != "" ? NOTIFY_SEND : 'echo') system("#{notify_send} #{Shellwords.escape(title)} #{Shellwords.escape(render_post(post))}") rescue UsageError usage end |
#usage ⇒ Object
9 10 11 |
# File 'lib/bbiff/show.rb', line 9 def usage STDERR.puts 'Usage: bbiff-show TITLE RES_LINE' end |