https://github.com/magdyamr542/project-root
Faster way to jump to the root of your project
https://github.com/magdyamr542/project-root
cd fast go navigate project-root-path shell
Last synced: 3 months ago
JSON representation
Faster way to jump to the root of your project
- Host: GitHub
- URL: https://github.com/magdyamr542/project-root
- Owner: magdyamr542
- Created: 2021-12-19T10:13:30.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T21:30:32.000Z (almost 2 years ago)
- Last Synced: 2025-10-29T23:35:06.875Z (8 months ago)
- Topics: cd, fast, go, navigate, project-root-path, shell
- Language: Go
- Homepage:
- Size: 1.82 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
j Project root

[](https://gifyu.com/image/SSISi)
- [Project root](#project-root)
- [Introduction](#introduction)
- [Stop wasting your time with `cd ../`](#stop-wasting-your-time-with-cd-)
- [Installation](#installation)
- [Usage](#usage)
## Introduction
#### Stop wasting your time with `cd ../`
- This enables you to return to the root directory of your project faster.
- It's meant for people who find it annoying to type `cd ../` a lot of times `:D`
- If you are in `./src/api/routes` you can simply use `pr` and you will automatically **cd** to the root of the project if its path was saved was `pr add` command.
```
.
├── dist
├── node_modules
├── package.json
├── src
│ ├── api
│ │ └── routes
│ │ └── getProduct.ts
│ └── utils
│ └── array.ts
└── tsconfig.json
6 directories, 4 files
```
## Installation
1. Run `mkdir ~/.proot`
1. Run `touch entryPoint.sh`
1. Put this in the file `entryPoint.sh`
```bash
function pr {
output=$(~/.proot/proot $@)
retCode=$?
if [[ ( $1 == "go" || $1 == "" || $1 == "back" || $1 == "b" || $1 == "to" || $1 == "t" ) && $retCode -eq 0 ]]; then
# cd when go or back command. hide output
cd $output
else
echo $output
fi
if [ $retCode -ne 0 ]; then
return $retCode
fi
}
```
1. Install the `proot` executable from [here](https://github.com/magdyamr542/project-root/releases/tag/2.0) and put it in the directory `~/.proot`
1. Add `source ~/.proot/entryPoint.sh` to your `.bashrc` or `.zshrc`. (This step is important)
1. Source your shell again or open a new terminal session.
1. Use `pr --help`
## Usage
1. Use `pr add [path]` to save the current path as a project root.
1. Use `pr` or `pr go` from any child directory of your project and you will jump to the root of the project as long as you saved its path like in step 1.
1. Use `pr list` to list all saved project root paths.
1. Use `pr purge` to delete any paths that were saved before but don't exist in the file system any more.
1. Use `pr clear` to delete all saved paths. (use with **CAUTION**)
1. Use `pr back` go back to the last path from which you used the `pr go` command
- let's say you are in `/home/user/project/src/utils` and you saved `/home/user/project/` as a project root
- Now you want to go back to the project root (to do something quickly) so you execute `pr go` or just `pr`
- What if you want to go back to `/home/user/project/src/utils` again to continue you work ? the `pr back` command helps with such case
- type `pr back` and it will cd to `/home/user/project/src/utils` automatically