In order to use all the power of Natural CLI, I've tried to use the following command syntax :
command [a] [b] [c]
which express exactly my needs (the user can choose any combinations of these optionals parameters).
Unfortunately it did not work.
I had a good parseResult with the command "command c" ; but I got a "No command matches" with "command a".
It worked also with "command a b c".
"command" wasn't interpreted as a command neither.
I don't think I made a mistake on my side (I put only letters inside brackets), however I would appreciate if you could tell me that it works on your side or if this syntax isn't supposed to be used.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that there are a bug when optional parameter is the last token and it is not present.
In your example will work any combination but if "c" is not present. It means:
command a b c => works
command b c => works
command a c => works
command c => works
command a b => hits the bug and fails
command b => hits the bug and fails
command a => hits the bug and fails
command a => hits the bug and fails
As an **ugly** workaround, you can add a "fake" last token, for instance:
command [a] [b] [c] fake
Of course, I'm going to check the code to solve this issue.
Thanks a lot for reporting!
Ferran
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
In order to use all the power of Natural CLI, I've tried to use the following command syntax :
command [a] [b] [c]
which express exactly my needs (the user can choose any combinations of these optionals parameters).
Unfortunately it did not work.
I had a good parseResult with the command "command c" ; but I got a "No command matches" with "command a".
It worked also with "command a b c".
"command" wasn't interpreted as a command neither.
I don't think I made a mistake on my side (I put only letters inside brackets), however I would appreciate if you could tell me that it works on your side or if this syntax isn't supposed to be used.
Thanks.
I said "any combinations of these optionals parameters" but I should have say "any combinations of these optionals tokens"
Hi Ca
I'm going to see what is happening. I hope I give you an answer shortly.
Regards,
Ferran
Hi again Cal,
It seems that there are a bug when optional parameter is the last token and it is not present.
In your example will work any combination but if "c" is not present. It means:
command a b c => works
command b c => works
command a c => works
command c => works
command a b => hits the bug and fails
command b => hits the bug and fails
command a => hits the bug and fails
command a => hits the bug and fails
As an **ugly** workaround, you can add a "fake" last token, for instance:
command [a] [b] [c] fake
Of course, I'm going to check the code to solve this issue.
Thanks a lot for reporting!
Ferran
Thank you for you answer !
I'm looking forward to getting your bug fix :)
Hi Cal,
The bug in fixed in the new release. You can download it here:
https://sourceforge.net/project/showfiles.php?group_id=208949
Thanks for reporting!
Ferran
Great :)
Thank you