-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support additional flags when running rebase #88
Comments
see #66 (comment) for approaches i would consider acceptable. notably i would not accept a pr for although frankly, if you're passing |
Thanks for the prompt reply! The idea behind the request was indeed in line with what you wrote in #66 (comment):
Regarding
Is it not compatible with This would be consistent with the behavior of many other CLI tools that need to pass in params to external CLI tools. |
and if i was in charge of those cli tools then they wouldn't do it either. the reason i'm opposed to it is because it's an implementation nightmare. splitting a single string into multiple strings is not a trivial problem, as shells themselves demonstrate. consider: # i want to run:
git rebase -x "make test && echo \"all clear\""
# now as a git absorb command:
git absorb --and-rebase --rebase-params '-x "make test && echo \"all clear\""' have fun parsing the content of |
To clarify what I meant - you wouldn't need to parse the contents of the string - you would treat it as a single argument. As a concrete example using the code from clap's readme: ~/t/t/t/debug (master)> ./tmp --name=Hello
Hello
~/t/t/t/debug (master)> ./tmp --name=Hello hello
error: unexpected argument 'hello' found
Usage: tmp [OPTIONS] --name <NAME>
For more information, try '--help'.
~/t/t/t/debug (master) [2]> ./tmp --name="-x \"make test && echo \"all clear\"\""
-x "make test && echo "all clear"" No parsing required - I'm proposing (in line with many CLI tools) that the onus be on the user to make sure their parameter is a single argument. |
but in your own example, the resulting behavior is incorrect:
this needs to be split into two arguments, # not to mention, passing --rebase-params -x is almost certainly going to confuse a cli parser
# you would have to pass it in the single argument form --rebase-params=-x
git absorb --and-rebase --rebase-params '-x' --rebase-params '"make test && echo \"all clear\""' which i think we can agree has no redeeming qualities compared to: git absorb --and-rebase -- -x "make test && echo \"all clear\"" |
Oh I see what you mean - it needs to be split into two arguments so it can be passed into Mmm indeed the complexity probably isn't worth it. |
Would you be receptive to a |
yep. in fact, as i mentioned in the linked comment, i think it is the only reasonable approach to achieve what you're asking for. luckily git absorb has no need for positional parameters (and hopefully stays that way...), so we can always assume that the |
The motivation for this request is similar to #48 - we want to run precommit hooks when rebasing with
git absorb
.There is a workaround for running precommit hooks when rebasing, outlined by this guide - the solution is to pass in
-x "..."
togit rebase
.When running
git absorb ... --and-rebase
we have no control over what flags to pass in togit rebase
.Is it possible to expand
git absorb
's parameters to receive something like a "--rebase-params" parameter that will be given togit rebase
? This will enable a powerful alias likegit absorb --and-rebase --base origin/main --rebase-params "..."
.P.S. huge thanks for this great tool!! It's a major productivity boon for us
The text was updated successfully, but these errors were encountered: