lib/calabash/cli/helpers.rb in calabash-2.0.0.pre2 vs lib/calabash/cli/helpers.rb in calabash-2.0.0.pre3

- old
+ new

@@ -1,10 +1,11 @@ module Calabash # @!visibility private module CLI # @!visibility private module Helpers + # @!visibility private HELP = { help: 'help', generate: 'generate', run: 'run [application] [cucumber options]', console: 'console [application]', @@ -12,20 +13,22 @@ setup_keystore: 'setup-keystore', resign: 'resign <apk>', build: 'build <apk>' } + # @!visibility private def key_for_command(command) HELP.each do |key, value| if value.split(' ').first == command return key end end nil end + # @!visibility private def print_usage_for(key, output=STDOUT) if key.nil? || HELP[key].nil? output.write <<EOF No such command '#{key}' EOF @@ -35,10 +38,11 @@ calabash [options] #{HELP[key]} EOF end end + # @!visibility private def print_usage(output=STDOUT) output.write <<EOF Usage: calabash [options] <command-name> [command specific options] <command-name> can be one of #{HELP[:help]} [command] @@ -99,14 +103,16 @@ -v, --verbose Turns on verbose logging EOF end + # @!visibility private def help file_name = File.join(File.dirname(__FILE__), '..', 'doc', 'calabash_help.txt') system("less \"#{file_name}\"") end + # @!visibility private def fail(reason, command=nil) STDERR.write("#{reason}\n") if command != nil print_usage_for(command)