You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is currently possible - I haven't seen anything in the README.
Right now, it seems like required option flags are handled by Clim, while required arguments are not.
Is there a DSL command similar to option to define required args? I believe that having such a command would be beneficial in two ways:
We can get arguments by their name, and not by their place.
We will not need to handle missing arguments on our own, as it will be handled by Clim.
Example to demonstrate. Consider this code:
require"clim"moduleHelloclassCli < Clim
main do
usage "hello <name>"
run do |opts, args|
if args.empty?
puts opts.help_string
elseputs"hello #{args.first}"endendendendendHello::Cli.start(ARGV)
Would be much nicer if it can be written like this:
main do
usage "hello <name>"
argument "name", type:String, required:true
run do |opts, args|
# We will not be in this block unless <name> is givenputs"hello #{args.name}"# <- using args.name instead of args.firstendend
The text was updated successfully, but these errors were encountered:
Hi,
I am not sure if this is currently possible - I haven't seen anything in the README.
Right now, it seems like required option flags are handled by Clim, while required arguments are not.
Is there a DSL command similar to
option
to define required args? I believe that having such a command would be beneficial in two ways:Example to demonstrate. Consider this code:
Would be much nicer if it can be written like this:
The text was updated successfully, but these errors were encountered: