-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
When using the configuration file like the examples you end up with a string and symbol key.
#!/usr/bin/env ruby
require 'cl'
module Example
class Foo < ::Cl::Cmd
opt '--foobar STRING', default: 'Foobar default value'
def run
puts opts.to_yaml()
end
end
end
File.open('.example.yml', 'w') do |file|
file.puts <<~yml
---
foo:
foobar: 'Foobar from Yaml'
yml
end
puts "Default options used"
Cl.new('example').run(['foo'])
puts "--------------------"
puts "Command line used"
Cl.new('example').run(['foo', '--foobar', 'From command line'])
puts "--------------------"outputs
Default options used
---
foobar: Foobar from Yaml
:foobar: Foobar default value
--------------------
Command line used
---
foobar: Foobar from Yaml
:foobar: From command line
--------------------
Metadata
Metadata
Assignees
Labels
No labels