An argument is a token passed after the command name.
For instance, given the foo greet command, when an user types foo greet Luca, then Luca is considered an argument.
A command can accept none or many arguments.
An argument can be declared as required.
#!/usr/bin/env ruby
extend Dry::CLI::Registry
argument :name, required: true, desc: "The name of the person to greet"
argument :age, desc: "The age of the person to greet"
result = "Hello, ."
result = " You are years old." unless age.nil?
puts result
end
end
register "greet", Greet
end
end
end
Dry::CLI.new(Foo::CLI::Commands).call