Useful snippets
pshd
Populate ~/.config/sara/pshd with absolute paths to common locations on your system, and define this pshd function in your shell config. Entering pshd [num] will then cd to the chosen directory in your shell, mimicking the pshd function from SARA.
function pshd {
dirs_file="$HOME/.config/sara/pshd"
temp_file="$HOME/.config/sara/temp"
if (( $# > 0 )); then
re='^[0-9]+$'
if [ "$1" = "-l" ] || [ "$1" = "-q" ]; then
counter=0
while read p; do
echo "[$counter] $p"
((counter++))
done <$HOME/.config/sara/pshd
elif [ "$1" = "--" ]; then
cd $(head -n 1 $HOME/.config/sara/pshd)
elif [ "$1" = "-e" ]; then
nvim $HOME/.config/sara/pshd
elif [[ $1 =~ $re ]] ; then
counter=0
while read pshd; do
if [[ counter -eq $1 ]] ; then
cd "$pshd"
fi
((counter++))
done <$HOME/.config/sara/pshd
elif [[ $1 =~ "-p" ]] ; then
echo $PWD >> $HOME/.config/sara/pshd
awk '!seen[$0]++' $HOME/.config/sara/pshd > $HOME/.config/sara/temp
mv $HOME/.config/sara/temp $HOME/.config/sara/pshd
head -n 100 $HOME/.config/sara/pshd > $HOME/.config/sara/temp
mv $HOME/.config/sara/temp $HOME/.config/sara/pshd
else
echo "no-op"
fi
else
counter=0
while read p; do
echo "[$counter] $p"
((counter++))
done <$HOME/.config/sara/pshd
fi
}
ncurses-loading-bar
Write-up on the way. Sit tight.