bin/balboa in balboa-0.1.6 vs bin/balboa in balboa-0.1.7

- old
+ new

@@ -5,21 +5,24 @@ require_relative '../lib/balboa/cli/parser' require_relative '../lib/balboa/interactor/interactor_builder' require 'highline/import' -options = if File.exist?(Balboa::CONFIG_FILE) - YAML.load_file(Balboa::CONFIG_FILE) - else - Balboa::CLI::Defaults.prompt(HighLine) - end +options = Balboa::CLI::Parser.parse(ARGV) -Balboa::CLI::Parser.parse(ARGV, options) +defaults = if options['skip_defaults'] + {} + elsif File.exist?(Balboa::CONFIG_FILE) + YAML.load_file(Balboa::CONFIG_FILE) + else + Balboa::CLI::Defaults.prompt(HighLine) + end -raw_interactor = Balboa::Interactor::InteractorBuilder.create(options) -interactor = Balboa::Interactor::InteractorWrapper.new(raw_interactor) +options = defaults.merge(options) +interactor = Balboa::Interactor::InteractorBuilder.create(options) + app_last = Balboa::CLI::Command::LastCommand.new(interactor) app_punch = Balboa::CLI::Command::PunchCommand.new(interactor, HighLine) app_reset = Balboa::CLI::Command::ResetCommand.new app_star_wars = Balboa::CLI::Command::StarWarsCommand.new @@ -29,10 +32,10 @@ app.add_command(:punch, app_punch) app.add_command(:reset, app_reset) app.add_command(:star_wars, app_star_wars) begin - app.execute + $stdout.puts(app.execute) rescue Balboa::CLI::Application::CommandNotFound $stdout.puts("\nCommand Not Found!") $stdout.puts("\nRun `balboa -h' to check available commands and options.") rescue Balboa::Interactor::Command::LoginCommand::LoginFailure $stdout.puts("\nWrong e-mail or password!")