Created
February 6, 2016 17:11
-
-
Save nriley/34d92c9eb2eaf1073c04 to your computer and use it in GitHub Desktop.
Timestamp your command output with zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ts() { | |
local tspty=tspty.$(/usr/bin/uuidgen) | |
zmodload zsh/zpty | |
zpty $tspty $@ | |
setopt localtraps | |
TRAPINT() { zpty -d $tspty } | |
while zpty -r $tspty line; do | |
print -Pn '%B%D{%m/%d %H:%M:%S}%b ' | |
print -n -- $line | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment