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
{{ message }}
Repository navigation
hasFlag - Wrong documentation or implementation? #29
Hello @obstschale The implementation is correct as it is a standard that flags start with -, -- if you have a look at the CommandCall class you can see the method that is parsing flags here
I am not sure also if it is a documentation issue as it can be written that way to evaluate to false,
So lets get @erikaheidi to confirm.
Hello @obstschale , thank you very much for opening this issue. My initial intention was to save the flags without the -- portion, and somewhere along the way I thought it could lead to confusion - but my thoughts clearly got mixed up when writing the docs.
However, thinking again about this, I believe it makes more sense to go with this approach. I am working on a fix now to allow for both ways (otherwise it could definitely cause backwards compatibility issues), please keep an eye for the coming release.
My initial intention was to save the flags without the -- portion, and somewhere along the way I thought it could lead to confusion - but my thoughts clearly got mixed up when writing the docs.
Actually, I was thinking the same. In my eyes -- is just the indicator that the following is a flag. But it is not part of the flag. Hence, the method hasFlag does not need the -- because, hey the method name itself already says it.
But I'm totally fine with the current implementation. But I would love the see that the documentation matches the implementation :D
Activity
lotfio commentedon May 7, 2021
Hello @obstschale The implementation is correct as it is a standard that flags start with
-,--if you have a look at the CommandCall class you can see the method that is parsing flags hereI am not sure also if it is a documentation issue as it can be written that way to evaluate to
false,So lets get @erikaheidi to confirm.
erikaheidi commentedon May 8, 2021
Hello @obstschale , thank you very much for opening this issue. My initial intention was to save the flags without the
--portion, and somewhere along the way I thought it could lead to confusion - but my thoughts clearly got mixed up when writing the docs.However, thinking again about this, I believe it makes more sense to go with this approach. I am working on a fix now to allow for both ways (otherwise it could definitely cause backwards compatibility issues), please keep an eye for the coming release.
erikaheidi commentedon May 8, 2021
and thank you so much @lotfio for jumping in ❤️
Fixing #29 - now obtaining flags also without --
Merge pull request #30 from minicli/fix-flags
obstschale commentedon May 8, 2021
Actually, I was thinking the same. In my eyes
--is just the indicator that the following is a flag. But it is not part of the flag. Hence, the methodhasFlagdoes not need the--because, hey the method name itself already says it.But I'm totally fine with the current implementation. But I would love the see that the documentation matches the implementation :D
erikaheidi commentedon May 8, 2021
Thank you again! The new release is out 🎉 please update :D going ahead and closing this now.