-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
Maybe that's a dumb question, but firs of all take a look at this minimal working example:
#!/usr/bin/env ruby
module Minimal
require 'rubygems'
require 'commander/import'
class CLI
include Commander::Methods
def self.parse(args)
program :name, 'MWE'
program :version, '0.0.1'
program :description, 'Minimal Working Example'
command :hello do |c|
c.syntax = 'mwe hello'
c.description = 'Say hello to everyone'
c.option '--spanish', 'Say Hello in Spanish'
c.option '--french', 'Say Hello in French'
c.action do |args, options|
say options.default
options.default
end
end
end
end
end
module Minimal
class Working
def self.example(args)
option = CLI.parse args
if option.name = 'hello'
#=> How can I check if spanish of french option is true?
end
end
end
end
Minimal::Working.example ARGV
Well actually I'm trying to acces to options.default value outside the Commander space object, but I failed. What am I missing?
Thanks in advance
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels