THIS REPOSITORY IS DEPRECATED
HEAD TO abzicht/tp for the latest commits
Teleport - A bash tool for transitioning from one directory to another.
tp --> tp -/> cd --! dc --x
tp is just a wrapper for cd. It makes use of so called portals that point
to user defined directories.
Let's say your current working directory is ~/Documents/foo/bar/1/oak/blah
and you quickly want to change your directory to ~/Documents/oof/rab/1/kao/halb.
Consequently, you will start entering dots into your command line:
$ cd ../../../../oof/rab/1/kao/halbSince you are using both blah and halb very regularly, you often find yourself
entering such commands. You maybe start wondering: isn't there a nice alternative
to such mind numbing procedure? Wonder no more! tp is here to save you.
With tp, switching from ~/Documents/foo/bar/1/oak/blah to
~/Documents/oof/rab/1/kao/halb is done in a 7 char command:
$ tp halb
halb --> HOME/Documents/oof/rab/1/kao/halbAnd when you want to switch back, simply enter tb blah:
$ tp blah
blah --> HOME/Documents/foo/bar/1/oak/blahEverybody has a couple of static directories she/he uses on a daily basis.
Such directories are the perfect use case for tp. Of course, seldom used
directories, e.g. ~/Documents/code/java/sesame/src/main/java/io, do not
require a separate portal, when ~/Documents/code/java/sesame/ already has one.
tp was developed with the ambition to create a minimalistic tool that offers
great ease of use.
Before teleporting to a directory is possible, a portal must be created for that directory:
# This creates a portal called "local" that points to ~/.local/share by
# appending it to ~/.tp_config
$ tp -a local ~/.local/shareOf course, you can also manually add portals by editing ~/.tp_config
with your favorite text editor.
Let's say that this is your ~/.tp_config file:
up=../
r=/
root=/root
documents=HOME/Documents/
local=HOME/.local/share
code=HOME/Documents/code/
bash=HOME/Documents/code/bash
java=HOME/Documents/code/java
clargs=HOME/Documents/code/java/clargs/src/main/java/org/ruhe
py=HOME/Documents/code/python
python=HOME/Documents/code/python
go=HOME/Documents/code/go
tp=HOME/Documents/code/bash/teleport
volumes=/var/lib/docker/volumes
You are currently working on a python project and want to switch to your java
project called clargs. Instead of using cd with a (long) relative path or
inconvenient absolute path, you simply enter this command:
$ tp clargs
clargs --> HOME/Documents/code/java/clargs/src/main/java/org/ruheClone this repo and run the install script:
$ git clone https://github.com/bitteruhe/tp && cd tp
$ ./install.shIf you don't want to run the install script, follow these steps:
- Let
$pathbe the path you storetpat - Add the following line to
$HOME/bashrc:source $path/tp - Apply the changes:
source $HOME/.bashrc
After running tp for the first time, the two files ~/.tp_config and ~/.tp_config.defaults are created. Add your own portals to ~/.tp_config with tp -a or
use the existing portals in ~/.tp_config.defaults.