-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ability to specify command when hitting enter #1223
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
cc5edfe to
1b79340
Compare
1b79340 to
7654970
Compare
| Any arguments to git repl will be taken as the first command to execute in | ||
| the repl. | ||
|
|
||
| You can specify a default command to run when hitting enter: |
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.
Let's also update https://github.com/tj/git-extras/blob/main/man/git-repl.md and generate new man page
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.
done
bin/git-repl
Outdated
| if test -n "$on_enter_cmd"; then | ||
| eval "$on_enter_cmd" | ||
| fi | ||
| continue |
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.
The continue will skip exit_status=$? below?
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.
before my change, when there was an empty command, the result was continue
after my change, now there is the optional command executed, and then always continue like before
(maybe you know this and are asking something else)
i just now tested the exit_status feature with and without git-extras.repl.on-enter-command being set and it still works
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.
@jjb
So the custom command, unlike the command input for prompt, doesn't affect the exit status. Is it intended?
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.
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.
happy to make the dfault command also do this
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.
I guess it is used to provide a feature like echo $?, since the $? is not available in the next prompt.
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.
hyperupcall
left a comment
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 LGTM assuming the comments by @spacewander are addressed!
impetuous: persist return val for display in promt if non-zero also future-proofs for other benefits / DRYness. no need for another eval invocation.
| "") continue;; | ||
| "") | ||
| on_enter_cmd=$(git config --get --default '' git-extras.repl.on-enter-command) | ||
| if test -n "$on_enter_cmd"; 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.
i did test that this is false when the setting is unset (i.e. test -n is false for blank string)
spacewander
left a comment
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.
LGTM
|
@jjb |

closes #1222