-
-
Notifications
You must be signed in to change notification settings - Fork 94
Allow empty string as argument (replacing #122) #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
LGTM, thanks for dealing with the merge conflict and additional tests. |
|
...no, this is still not working - I did not approve the approval tests because I still don't get the result we need. Was hoping you will take a look, but I will see if I can "bring it home" today. |
| % condition = "if" | ||
| % args.each do |arg| | ||
| <%= condition %> [[ ! ${args[<%= arg.name %>]} ]]; then | ||
| <%= condition %> [[ -z ${args[<%= arg.name %>]+x} ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the additional change I needed to do.
This runs after all other input was already assigned to things, and when we reach this point, it means we still have input in the argv array, so if any of the positional arguments are not yet assigned, assign them.
Tests are passing, but I hope I didn't get it wrong - my head is spinning from all the double-negatives...
| args: | ||
| - ${args[--flag]} = | ||
| - ${args[optional_arg]} = | ||
| - ${args[required_arg]} = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the approval that the above -z change fixed - notice that when calling the command with empty args (optional, required and flag arg) - they are still assigned to the args associative array, as intended.
|
@wolfgang42 - I believe this is now fixed, but would like your second opinion please. I commented the two suspect bits. If you approve, I can merge. |
|
@wolfgang42 - I was hoping you would take a look at this, but I will merge it now. I will wait for another day before releasing. |
Attempt resolution for, and closes #122
Reference: How to check if a variable is set in Bash?