Created
January 24, 2011 21:44
-
-
Save imanel/794022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
some: args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> 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"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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