-
Notifications
You must be signed in to change notification settings - Fork 120
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
[feature request] ssh postcmd and precmd #85
Comments
Does this do what you want? function ssh() {
# put precmd code here
z4h ssh "$@"
# put postcmd code here
} |
It would, yes, but it doesnt give me the flexibility as I may want to use specific zstyle's for specific hosts, which in my daily work tends to happen a lot. If I can do: zstyle -e ':z4h:ssh:*' postcmd 'reread_history'
zstyle -e ':z4h:ssh:some_box' postcmd 'something specific for that host' It is much more flexible and lets me utilize the already established nomenclature for other z4h controls. or maybe i am trying to force z4h to do too much, which is also a valid answer. |
Asking for more is not a problem. The most valuable thing (for me) would be if you can explain your use case. What do you want to run in postcmd that depends on the host? |
So i connect to a ton of airgapped boxes in which case I use my laptop as the source of truth, which holds all my configs/etc. Since switching to One caveat (and this is something I think you have added to your already long TODO list) is that when I hop on an airgapped box my setup does not come with me, not huge problem, but it does slow me down. So to work around the limitation I have cobbled together a custom My limitation to this approach is two fold, its much cleaner to breakout my "workarounds" for airgapped boxes by executing zstyle -e ':z4h:ssh:air_gapped_boxes*' precmd 'send over z4h and binaries before \
z4h ssh does its install attempt and fails'
zstyle -e ':z4h:ssh:*' postcmd 'reread_history'
zstyle -e ':z4h:ssh:air_gapped_boxes*' postcmd 'reread_history && reset_tmux_layout \
&& something_else' |
Do I understand it correctly that you wouldn't need precmd/postcmd if |
Yes that would solve my problems |
Got it. Then I'll need to make I won't be adding precmd/postcmd hooks at this time. Any feature that I add should have at least one use-case/problem for which it is the best solution. These hooks don't have such a use-case/problem yet, so it's premature to add them. |
thats fair, feel free to close |
I am going to use your history sync as an example of why it could be useful (as described in #35 (comment))
This sends along the history files from the local machine to remote
This brings back the histories from the remote box
Now with all in place, the retrieved history is not read in until I open a new terminal. In this case it would be useful to have something like (fully recognizing that this can be made smarter to not re-read full history but only freshly retrieved files, its just easier as an example)
I can also see the usefulness of having a
precmd
which will let me do and manipulate some things, the idea comes from your own dotfiles using thezstyle ':z4h:term-title:ssh' precmd ${${${Z4H_SSH##*:}//\%/%%}:-%m}
directives, i just think there are use cases outside of term-title for it.The text was updated successfully, but these errors were encountered: