/wd

a utility for warping between directories

Primary LanguagePythonMIT LicenseMIT

wd - warpdir(1)

A bit like mfaerevaag/wd, warp to directories.

Install

Move, link or copy wd.py to ~/bin/wd.py.

Edit ~.bashrc/.zshrc:

wd()  { 
    cd $(~/bin/wd.py $1) 
}
wdl() {
    cat ~/.wdrc 
}

Usage

A pathfile (~/.wdrc) consists of key=value pairs of aliast=path strings.

For example, projc1 is the alias and /src/projects/projectOne is the destination.

proj1=~/src/projects/projectOne
proj2=~/src/projects/projectTwo

The pathfile alias is used to move to the destination:

$ wd proj1
$ pwd 
/src/projects/projectOne

Extension

echo "alias=$(pwd)" >> ~/.wdrc
# ~/.bashrc||.zshrc
wadd(){
    echo "$1=$(pwd)" >> ~/.wdrc
}
# ~/.bashrc||.zshrc
wlink(){
    echo "$1=realpath($2)" >> ~.wdrc
}