🌈
enum was added in #237, but it originally only validated type: string values.
Validation of type: numeric values was added in #386
I expected all values of my type: array option to also be validated.
Example
cli.rb:
require "thor"
class MyCLI < Thor
desc "array_with_enum [--fruits=apple banana]", "Demo of using an enum with an array"
option :fruits, type: :array, enum: ["apple", "banana", "clementine"]
def array_with_enum
puts "fruits: #{options[:fruits]}"
end
end
MyCLI.start(ARGV)
This works:
ruby ./cli.rb array_with_enum --fruits=banana apple
fruits: ["banana", "apple"]
This also works:
ruby ./cli.rb array_with_enum --fruits=kiwi
fruits: ["kiwi"]
but shouldn't since "kiwi" is not a fruit in the enum.
🌈
enumwas added in #237, but it originally only validatedtype: stringvalues.Validation of
type: numericvalues was added in #386I expected all values of my
type: arrayoption to also be validated.Example
cli.rb:This works:
This also works:
but shouldn't since "kiwi" is not a fruit in the
enum.