if ARGV.empty? ARGV << '--help' end HELP_TEXT = <<-EOT Usage: couch COMMAND [ARGS] The most common couch commands are: generate Generate new code (short-cut alias: "g") push Push application code to CouchDB pull Pull latest application code from CouchDB routes List application urls In addition to those, there are: destroy Undo code generated with "generate" All commands can be run with -h for more information. EOT case ARGV.shift when 'g', 'generate' require 'couch/commands/generate' when 'destroy' require 'couch/commands/destroy' when 'push' require 'couch/commands/push' when 'pull' require 'couch/commands/pull' when 'routes' require 'couch/commands/routes' when '--help', '-h' puts HELP_TEXT when '--version', '-v' require 'couch/version' puts "Couch #{Couch::VERSION}" else puts "Error: Command not recognized" puts HELP_TEXT end