basho / clique

CLI Framework for Erlang
Apache License 2.0
147 stars 49 forks source link

Don't throw error on empy argument #89

Closed codeadict closed 4 years ago

codeadict commented 4 years ago

I tried to use an empty value argument like the following:

$ my-cli command foo=

And results in the following error:

    {'EXIT',
     {function_clause,
      [{clique_error,
    format,
    ["my-cli",
     {error,
      {invalid_kv_arg,
       "foo"}}],
    [{file,
      "/mycli/_build/default/lib/clique/src/clique_error.erl"},
     {line,
      29}]},
       {clique,
    print,
    3,
    [{file,
      "/mycli/_build/default/lib/clique/src/clique.erl"},
     {line,
      109}]},
       {clique,
    print,
    2,
    [{file,
      "/mycli/_build/default/lib/clique/src/clique.erl"},
     {line,
      92}]},
       {rpc,
    '-handle_call_call/6-fun-0-',
    5,
    [{file,
      "rpc.erl"},
     {line,
      197}]}]}
}

IMHO, instead of raising an error clique should pass an empty string "" as the value or even better catch the error and show a clique message instead of the stack trace.

codeadict commented 4 years ago

CC @martinsumner

codeadict commented 4 years ago

Closing this as it is merged to develop-3.0