# GCD - A different cd
Primary used for quickly navigating between git projects.
Supports
- git projects, the GCD database is populated using the gcd-init/gcd-update commands.
- non project folders, these can be added to the GCD database with gcd-add command.
- aliases for git project and non git project folders can be set using the gcd-alias command.
Note:
A git project folders is a folder that has a '.git' sub folder, no other checks are done.
## Installation
Currently you need to build the binaries your self.
### prerequisites
A working Rust build system https://www.rust-lang.org/tools/install.
### the code
Get the code from.
```bash
git clone https://gitlab.com/pnmtjonahen/pepercoin.git
```
Build and install it.
```bash
cargo install --path .
```
Once the console dependency is updated this will change in a normal ```cargo install```
### Installation
#### binaries
Install the binaries as described above.
#### script (unix)
Either copy the gcd script from the scripts folder into your ${HOME}/bin folder. (or equivalent, like ${HOME}/.cargo/bin)
Or create a gcd.sh script as follows
```bash
#!/bin/bash
SCRIPT_FILE="${HOME}/.gcd/gcd-cd.sh"
gcd-select $@
if [[ -f "${SCRIPT_FILE}" ]]; then
source ${SCRIPT_FILE}
rm ${SCRIPT_FILE}
fi
```
#### bash alias
And lastly, make an entry into your .bash_aliases file like:
```
alias gcd='source /home/user/.cargo/bin/gcd.sh'
```
Note: sourcing the shell script is needed else the internal 'cd' command will not work as expected.
#### script (windows)
Either copy the gcd.bat script from the scripts folder into your path folder. like ${APPDATA}/.cargo/bin
Or create a gcd script as follows
```bat
@echo off
call gcd-select
if exist %APPDATA%\.gcd\gcd-cd.bat (
%APPDATA%\.gcd\gcd-cd.bat
del /s %APPDATA%\.gcd\gcd-cd.bat
)
```
#### first time use
after installation call the gcd init to initialize the database and perform the initial search for projects_dir
```bash
gcd-init
```
## Basic use
gcd is made up out of a number of different applications. Gcd-select is the main one, it is however not called directly but via a shell script.
- gcd-select, called from the gcd script and is used to select a project.
- gcd-init, initializes the database. it will overwrite the complete database. loosing all usage data, and aliases.
- gcd-alias, set an alias for the current folder, if the current folder is not a known project. nothing will happen.
- gcd-add, adds the current folder to the database.
- gcd-purge, purges aka removes all project from the database that are no longer available.
- gcd-delete, removes the current folder from the database.
- gcd-update, updates the database, as opposed to the gcd-init, this will only add projects that are not yet in the database