-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
WIP: Run hook functions before & after line execution #194
base: master
Are you sure you want to change the base?
Conversation
Hook is run when command throws an errors.
I don't fully understand the use for this feature, if I want to time something usually I would just write a time function. |
Borrowed the idea from ZSH. It's usually used to enhance prompt and timing is just an example (though I'm often wandering how long does something takes only after starting it ;) ). This is needed for another PR which allows |
I understand - I am still unsure, I will need to think about it and read the zsh documentation. |
It seems to me this patch breaks multi line input. |
Should be easy to fix. Basically need to do the same thing you do in |
Right, I am leaning towards allowing the repl changes to hide the exit codes, in which case that fix may be able to go there. |
There is a kind of hook commonly found in shells which is executed right before showing the prompt (and sometimes also after showing it). This is used by direnv integrations, which I must currently call in my prompt function. For reference:
|
@pauldub You're right, equivalent of |
I like direnv, so that is a good argument for me. |
Once changes to repl in #161 are done, I will update this & add precmd hook also. |
I would prefer on-crash be renamed to on-error or something else, it isn't necessarily a 'crash'. I know one use for this hook is what nixos does, which is to offer a list of packages for a user to install if a binary is missing. |
Sure, so |
Runs
*pre-exec-hook*
&*post-exec-hook*
functions before/after execution of a line. Can be used to time how long a command took: