Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4636

Parse Thor options outside of class

$
0
0

I would like to parse again some Thor options outside of a Thor class as I have no control on the Thor class and the instance of it. Unfortunately the parse function is not for getting the values out of the argv. What I already looked for:

  1. https://www.rubydoc.info/github/wycats/thor/Thor/Option#parse-class_method
  2. https://github.com/rails/thor/blob/main/lib/thor/parser/options.rb
  3. https://github.com/rails/thor/blob/main/lib/thor/parser/option.rb

I whould like the following:

Class Mycli < Thor  def someOptions    option :aaaa, aliases: :a, type: :string,    desc: "AAAAAAAAAAAAAA"  option :bbbb, aliases: :b, type: :string,    desc: "BBBBBBBBBBBBBB"  end...end# code having control on:options = Mycli.someOptionsr = options.parse_arg($ARGV)  # ["-a" "stringA", "-b", "stringB"]p r[:a]  # "StringA"

Viewing all articles
Browse latest Browse all 4636

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>