Sha256: 8709c1654c84d00b1cbd837393b8b172fe0fa1b37c5b3af9ecaa530241861fbe

Contents?: true

Size: 997 Bytes

Versions: 6

Compression:

Stored size: 997 Bytes

Contents

#!/usr/bin/env ruby

require 'optionparser'

APP = File.basename(__FILE__)

commands = {
    "explain" => "Generate a report from logged SQL queries",
    "review"  => "Review changed files for query problems",
    "dump_stats" => "Collect database statistics for more accurate analysis",
    "web" => "Generate a report from JSON-explain"
}

global = OptionParser.new do |opts|
  opts.banner = "usage: #{APP} [--help] <command> [<args>]"
  opts.separator ""
  opts.separator "These are the commands available:"
  commands.each do |name,info|
    opts.separator "  #{name}     #{info}"
  end
  opts.separator ""
  opts.separator "See #{APP} --help <command> to read about a specific command."
  opts.separator ""
end

global.order!

command = ARGV.shift

if command.nil?
  puts global.to_s
  exit
end

if !commands.key?(command)
  puts "#{APP}: '#{command}' is not a '#{APP}' command. See '#{APP} --help'."
  exit 2
end

path = File.join(File.dirname(__FILE__), command)

Kernel.exec(path, *ARGV)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shiba-0.9.4 bin/shiba
shiba-0.9.3 bin/shiba
shiba-0.9.2 bin/shiba
shiba-0.9.1 bin/shiba
shiba-0.9.0 bin/shiba
shiba-0.8.1 bin/shiba