pecoとhubでpullrequestをスムーズにする
たくさんのプロジェクトにPRを出していると、自分がどの作業をしているのかよくわからなくなってくる。
それに、githubを中心として開発している組織だと、PRのdescriptionを追うことが効果的なキャッチアップ方法だったりするので、PRをスムーズに調べる力は重要だ。
最初はgithubのwebから調べていたのだけど、だんだんわざわざブラウザに移るのが面倒臭くなって、手頃なものがなかったのでpecoのツールを作ってみた。
zsh on macでしか動作確認していない。~/.zshrc
に下記のコードをコピペして、exec -l ${SHELL}
する。
function peco-github-prs () {
local pr=$(hub pr list -s all -f "%I %pS %t author:%au%n" 2> /dev/null | peco --query "$LBUFFER" | sed -e 's/.*( \(.*\) )$/\1/')
if [ -n "$pr" ]; then
BUFFER="hub browse -- pull/${pr}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-github-prs
bindkey '^P' peco-github-prs
そうして、^Pを押せば、ズラッとprが出てきて選べて、エンターを押せばブラウザが立ち上がる。便利。
QUERY> IgnoreCase [23 (1/1)]
45 open Add Info Metric author:ajcrowe
44 closed Add Health Check author:ajcrowe
42 draft Kubernetes compatible dashboards author:blackjid
40 open Add Synced To Chain author:ajcrowe
39 open docs: add default grafana password to install instructions author:xsb
38 open Exit clean when help is shown author:xsb
35 open dashboards: switch to irate for peer bytes sent/recv author:Roasbeef
33 merged go.mod: update to requiring lnd 0.7.1-beta author:valentinewallace
32 merged dashboards: only display heap info for lnd author:Roasbeef
30 merged dashboards: more accurate CPU usage for the perf dashboard author:Roasbeef
26 open grafana/network: overlay capacity and channels with block height author:cfromknecht
25 open collectors/graph_collector: add num zombies author:cfromknecht
24 merged collectors: flatten graph metrics, update peer dashboard author:Roasbeef
23 merged INSTALL.md: add note to edit prom.yml for remote nodes author:valentinewallace
22 merged README: add new set of default dashboards, update README with pic author:Roasbeef
21 merged set default Grafana home dashboard. author:valentinewallace
17 merged INSTALL.md: clarify nginx instructions + add ToC author:valentinewallace
11 merged nginx.conf: increase header+body limits author:valentinewallace
10 merged grafana channel dashboard: remove Lingering HTLC Count panel author:valentinewallace
9 merged docker-compose: always restart Prometheus container author:valentinewallace
3 merged Lndmon fixups author:valentinewallace
2 merged Initial version of lndmon. author:valentinewallace
1 closed Basic prometheus author:valentinewallace
それにしても、この仕事をはじめたばかりの頃は、なんでみんなあんなに作業効率化にこだわるんだろう、、、って思ってたな。なんとなく感覚はわかりつつある。