Skip to content

Conversation

@DannyBen
Copy link
Member

@DannyBen DannyBen commented Oct 22, 2021

Attempt resolution for, and closes #122

Reference: How to check if a variable is set in Bash?

@DannyBen DannyBen marked this pull request as draft October 22, 2021 05:25
@wolfgang42
Copy link
Collaborator

LGTM, thanks for dealing with the merge conflict and additional tests.

@DannyBen
Copy link
Member Author

...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.

@DannyBen DannyBen marked this pull request as ready for review October 23, 2021 06:37
% condition = "if"
% args.each do |arg|
<%= condition %> [[ ! ${args[<%= arg.name %>]} ]]; then
<%= condition %> [[ -z ${args[<%= arg.name %>]+x} ]]; then
Copy link
Member Author

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]} =
Copy link
Member Author

@DannyBen DannyBen Oct 23, 2021

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.

@DannyBen
Copy link
Member Author

@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.

@DannyBen DannyBen mentioned this pull request Oct 23, 2021
8 tasks
@DannyBen DannyBen added this to the v0.6.9 milestone Oct 23, 2021
@DannyBen DannyBen changed the title Fix #122 Allow empty string as flag argument (replacing #122) Oct 24, 2021
@DannyBen DannyBen changed the title Allow empty string as flag argument (replacing #122) Allow empty string as argument (replacing #122) Oct 24, 2021
@DannyBen
Copy link
Member Author

@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.

@DannyBen DannyBen merged commit 7187c48 into master Oct 25, 2021
@DannyBen DannyBen deleted the fix/pr-122 branch October 25, 2021 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants