near/near-cli-rs

as-read-only json-args should allow empty parameters

elliotBraem opened this issue · 3 comments

It's been common for me to use the cli to call view functions that require no input parameters. However, when doing so, I must choose to proceed with argument type (json-args, text-args, base64-args, or file-args), which then asks to input args. And if I select json-args (first option) but provide empty arguments, I get a "Data not in JSON format!" error.

Currently, my work around is to use "text-args", which does allow an empty string, but I think this should be allowed for json-args too -- OR, we should provide a "no-args" option which would appear first in the list.

frol commented

You can pass “no-args” as {} or an empty string and I don’t think it is worth adding another selection option, but we should improve the help message to guide users passing empty args. Let’s keep this issue open to collect more feedback from other users

frol commented

@elliotBraem I believe #285 addresses this issue by providing more explicit help messages and even includes an example of empty JSON args {}. What do you think?

@frol Ya, big fan of that, ty looks great!!