An option is a named argument that is passed after the command name and the arguments.
For instance, given the foo request command, when an user types foo request --mode=http2, then --mode=http2 is considered an option.
A command can accept none or many options.
#!/usr/bin/env ruby
extend Dry::CLI::Registry
option :mode, default: "http", values: %w[http http2], aliases: ["-m"], desc: "The request mode"
puts "Performing a request (mode: )"
end
end
register "request", Request
end
end
end
Dry::CLI.new(Foo::CLI::Commands).call