gh-clean-branches
gh-clean-branches copied to clipboard
fix: refactor to bash compatibility
Why did you make this change
Make it bash compatible and further the reach of your great extension!
Feel free to close if you're a big zsh fan and explicitly want to keep it this way.. Otherwise I think it'd be wise to make this more widely compatible! :tada:
What have you done in this PR
- Refactored a few high-level incompatible statements, like the array manipulation
- Formatted with
shfmtand also fixed allshellchecklinting errors (other than2207which is disabled file-wide)
What was left to do
Dependencies
- zsh
Checklist:
- [x] My code follows the style of this project
- [x] I have performed a self-review of my own code
- [x] I have have tested my code locally to prove my fix is effective or that my feature works
- [x] I have made corresponding changes to the README.md
Awesome work, @ndom91! :clap::clap: For the record, this was first raised in #2, and initial POSIX-ifying work was done in #3.
Awesome work, @ndom91! :clap::clap: For the record, this was first raised in #2, and initial POSIX-ifying work was done in #3.
Ah I hadn't even seen those haha. Thanks for the initial work then!!
Thanks for the great contribution, @ndom91!
I believe that relying on bash will allow more developers to enjoy this extension.
This is a significant change. It will take some time to review and test it.
I have one concern, though. This change may break the extension for a developer who only has zsh installed. Though, I assume that it is a rare case.
Thanks for the great contribution, @ndom91! I believe that relying on
bashwill allow more developers to enjoy this extension.This is a significant change. It will take some time to review and test it.
I have one concern, though. This change may break the extension for a developer who only has
zshinstalled. Though, I assume that it is a rare case.
Yeah I can double check and run it with Zsh as well. I have a macbook somewhere.. haha.
EDIT: Can confirm the array splitting doesn't work in zsh now.
See:
https://github.com/davidraviv/gh-clean-branches/blob/4b8efdc7cbc62c1f24c1813241c8f97e3a0bc710/gh-clean-branches#L43-L46
https://github.com/davidraviv/gh-clean-branches/blob/4b8efdc7cbc62c1f24c1813241c8f97e3a0bc710/gh-clean-branches#L82
Will work on this shortly
EDIT 2: Note - https://unix.stackexchange.com/a/491459
@ndom91 Sorry for the delay in testing this.
Please take a look at a test I made that compares the results of the current code (1st run) to the PR code (2nd run).
The branch add-git-ignore exists both on the remote and local. Hence the branch is not expected to be deleted.
✅ The current code doesn't list the branch for deletion - as expected. ❌ The PR code lists the branch for deletion - not as expected.
You are welcome to take a look and push a fix. I promise to test it quickly 😉
