Skip to content

Instantly share code, notes, and snippets.

@imanel
Created January 24, 2011 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imanel/794022 to your computer and use it in GitHub Desktop.
Save imanel/794022 to your computer and use it in GitHub Desktop.
$> ruby test.rb start --config config.yml --some-flag --some-option done
output:
{"some"=>"args"}
preferred output:
{"some"=>"args", "some-flag"=>true, "some-options"=>"done"}
require 'rubygems'
require 'rubikon'
class ConfigSample < Rubikon::Application::Base
global_option :c => :config
global_option :config, 'Override the configuration with the given file', :config_file do
path = File.dirname config_file
file = File.basename config_file
config = Rubikon::Config::Factory.new(file, path).config
@__app__.instance_eval { @config.merge! config }
end
flag :'some-flag'
option :'some-option', 1
command :start do
p config
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment