Skip to content
/ tp Public

Teleport - A bash tool for transitioning from one directory to another.

License

Notifications You must be signed in to change notification settings

bitteruhe/tp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation


THIS REPOSITORY IS DEPRECATED
HEAD TO abzicht/tp for the latest commits

TP

Teleport - A bash tool for transitioning from one directory to another.

tp --> tp -/> cd --! dc --x

What it is

tp is just a wrapper for cd. It makes use of so called portals that point to user defined directories.

Why you need TP

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/halb

Since 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/halb

And when you want to switch back, simply enter tb blah:

$ tp blah
blah --> HOME/Documents/foo/bar/1/oak/blah

Where you need TP

Everybody 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.

How you use TP

tp was developed with the ambition to create a minimalistic tool that offers great ease of use.

Setting up a portal

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/share

Of course, you can also manually add portals by editing ~/.tp_config with your favorite text editor.

TP in action

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/ruhe

Installation

Clone this repo and run the install script:

$ git clone https://github.com/bitteruhe/tp && cd tp
$ ./install.sh

If you don't want to run the install script, follow these steps:

  1. Let $path be the path you store tp at
  2. Add the following line to $HOME/bashrc: source $path/tp
  3. 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.

About

Teleport - A bash tool for transitioning from one directory to another.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages