mgi166/hipchat_searcher

View on GitHub
bin/hps

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require 'hipchat_searcher'
require 'slop'

hash = Slop.parse(help: true) do
  banner 'Usage: hps [searchword] [options]'

  HipchatSearcher::Options.with_value.each do |opt|
    on *opt
  end

  HipchatSearcher::Options.with_boolean.each do |opt|
    on *opt
  end

  on '-v', '--version', 'Print the version' do
    puts HipchatSearcher::VERSION
    exit 0
  end
end.to_hash

options = HipchatSearcher::Options.new(hash)

# run command
begin
  HipchatSearcher::Command.run(ARGV.shift, options)
rescue Interrupt
  $stderr.puts "HipchatSearcher execute interrupt, exit..."
  exit 1
end