🔌 Utilities
Write the following script to $HOME/.bash_profile
, then restart shell, then we can use cdrrh
and rrhpeco
command in the terminal.
cdrrh
changes directory to the specified repository.
cdrrh(){
path=$(rrh repository list --path $1)
if [ $? -eq 0 ]; then
cd $path
pwd
else
echo "$1: repository not found"
fi
}
rrhpeco
list repositories, and filtering them by peco
,
then change directory to the filtering result.
rrhpeco(){
csv=$(rrh list --path --csv | peco)
cd $(echo $csv | awk -F , '{ print $3 }')
pwd
}