seachicken / gh-poi

✨ Safely clean up your local branches
https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
MIT License
685 stars 19 forks source link

CLI flags for specific categories of deletion #127

Open riotrah opened 2 weeks ago

riotrah commented 2 weeks ago

Description Hi!

Great extension.

I was thinking about my own usage of this tool, plus #119, and thought about the following more general proposal to choice in deletion:

Or, slight alternative: --merged is always true, thus no need for --merged flag, so if the user runs gh poi --closed, it will delete both merged and closed PRs. However, if they only want to delete closed PRs, they can still do gh poi --closed --no-merged.

Additional context

When would you use poi to delete other than merged branches? Isn't that the whole point? I think poi has nice output, branch protection, --dry-run feature and convenient access with gh, so it has value even if only deleting closed/draft, as the alternative of manual deletion is worse and lacks the above features/protections, and I don't think it would be too hard to add such flags (as far as I can tell, correct me if I'm wrong!)

seachicken commented 1 week ago

Thank you for the good suggestion 😄 I sometimes want to delete "closed," too and I think it would be better to have the option to delete it since we can check it with a dry run.

The main thing to consider is what to do with the interface of the options. Since this tool is a command that starts with "gh," we place importance on affinity with the gh interface so that users can operate it intuitively. Since exclusion with --no-xxx probably falls outside this policy, how about adding targets like gh pr list?

However, if they only want to delete closed PRs, they can still do gh poi --closed --no-merged.

There are very few cases where you would want to delete only closed PRs, so it is better to start by only allowing the deletion of merged and closed PRs.