Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 1.11 KB

File metadata and controls

74 lines (52 loc) · 1.11 KB

GT

About

This program stores location bookmarks in a json file in the the user's config directory e.g. ~/.config on Linux.

Installation

Make sure your GOBIN environment variable is set.

git clone https://github.com/RafaelMDM/gt.git && cd gt/cmd/gt
go install

Then add this function to your .bashrc or equivalent file:

function gt {
    go_bin=$(go env GOBIN)
    out=$("$go_bin/gt" "$@")

    if [ "$#" -eq 1 ]; then
        cd "$out"
    else
        echo "$out"
    fi
}

Since a child process can't change the cwd of its parent, this bash function will retrieve the path and cd to it.

Usage

To add a new location bookmark:

gt add [name] [path]
# OR
gt [name] [path]

# Example: Save the cwd as "foo"
gt foo .

To remove a location bookmark:

gt rm [name]

# Example: Remove the "foo" bookmark:
gt rm foo

To list all locations:

gt list
# OR
gt

To go to a saved location bookmark:

gt [name]

# Example: Go to "foo"
gt foo

Author

Rafael Marques