I am trying to create an executable ruby script using Thor.
I determined the parameters of my task. So far i have something like this
class Command < Thor desc "csv2strings CSV_FILENAME", "convert CSV file to '.strings' file" method_option :langs, :type => :hash, :required => true, :aliases => "-L", :desc => "languages to convert" ... def csv2strings(filename) ... end ... def config args = options.dup args[:file] ||= '.csvconverter.yaml' config = YAML::load File.open(args[:file], 'r') end end
When csv2strings is called without arguments, I would like to call the config task, which would set the option :langs .
I have not yet found a good way to do this.
Any help would be appreciated.
netbe source share