【发布时间】:2018-07-03 20:34:09
【问题描述】:
我一直在尝试创建一个自动更新的git log --graph --no-pager。我使用fswatch 取得了一些进步,但我遇到了我的 git 历史实际上比我的屏幕显示的更大的问题。我尝试添加| head -n $((`tput lines` - 1)),但由于换行,输出仍然溢出。然后我尝试使用tput rmam 来禁用换行,但现在我通常看不到HEAD 指向的位置。
有人可以帮助我吗?理想情况下,我想删除 --no-pager,但我不知道如何使用 fswatch。这是我目前所拥有的:
function gwatch() {
tput rmam
location=$(git rev-parse --show-toplevel)
clear;
git --no-pager graph --color | head -n $((`tput lines` - 1));
tput smam
fswatch -or $location/.git | while read MODFILE
do
tput rmam
clear;
git --no-pager graph --color | head -n $((`tput lines` - 1));
tput smam
done
}
【问题讨论】:
-
cron 作业。
0 * * * * cd /path/to/repo; git log --graph --no-pager > logfile每小时运行一次。 -
...什么?我不明白 cron 工作在这里会有什么帮助......
-
既然可以盲目地每小时记录一次,为什么还要设置观察者?
-
...这不是我要求的...