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 a design choice or not.
It seems like in some cases, Clim handles exceptions on its own, and shows a friendly error to the user, and in other cases, it does not.
"Option that requires an argument" - this prints a friendly error
"Required options" - this raises an exception
Sample code
# src/bug1.crrequire"clim"moduleHelloclassCli < Clim
main do
usage "hello <name>"
option "--prefix <text>", type:String, desc:"Prefix.", required:true
run do |opts, args|
puts"ok"endendendendHello::Cli.start(ARGV)
Actual behavior
$ crystal run src/bug1.cr -- --prefix
ERROR: Option that requires an argument. "--prefix"
Please see the `--help`.
$ crystal run src/bug1.cr -- --prefix a
ok
$ crystal run src/bug1.cr
Unhandled exception: Required options. "--prefix <text>" (Exception)
from lib/clim/src/clim/command/parser.cr:31:11 in 'required_validate!'
from lib/clim/src/clim/command.cr:79:7 in 'parse_by_parser'
from lib/clim/src/clim/command.cr:72:14 in 'recursive_parse'
from lib/clim/src/clim/command.cr:62:7 in 'parse'
... snip ...
Expected behavior
$ crystal run src/bug1.cr
ERROR: required option: "--prefix"
The text was updated successfully, but these errors were encountered:
Hello,
I am not sure if this is a design choice or not.
It seems like in some cases, Clim handles exceptions on its own, and shows a friendly error to the user, and in other cases, it does not.
Sample code
Actual behavior
Expected behavior
The text was updated successfully, but these errors were encountered: