rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.12k stars 553 forks source link

Alternatives as an option #732

Closed hadmut closed 1 year ago

hadmut commented 4 years ago

Hi,

would be nice to have an option type to choose one of a given set opf alternatives. e.g.

method_option :fruit, type: :selection, values: [ :apple, :orange, :banana ]

and then call a program with examplebin --banana

regards

p8 commented 1 year ago

hi @hadmut, You should be able to do the following:

  method_option :fruit, type: :string, enum: %w(apple orange banana)