Goto Documentation

Simplifying terminal navigation

View the Project on GitHub gabrielg2020/goto

Welcome to Goto

goto is a lightweight terminal tool that simplifies directory navigation.


Contents


Getting Started

Installation

Using a Package Manager

Coming soon!

Manual Installation

1. Clone the repository:

git clone https://github.com/gabrielg2020/goto.git
cd goto

2. Build the binary:

go build -o goto ./cmd/

3. Move the binary to a directory in your PATH:

mv goto /usr/local/bin/

4. Install dependencies

Please make sure that these are installed.


Shell Integration

Automated Integration

Run the provided setup script to automate this setup:

./setup.sh

Manual Integration

Add the following function to your .bashrc or .zshrc:

goto() {
    dir=$(/usr/local/bin/goto "$@")

    if [ -d "$dir" ]; then
        echo "Changing directory to: $dir"
        cd "$dir"
    else
        echo "No directory selected or invalid directory: $dir"
    fi
}

Verify Installation

[!NOTE] Coming soon!

goto --help

Usage

Basic Command

goto <pattern>

Example

goto src

Options

Option Description
-d Specify maximum search depth.
-h Display help message.
<pattern> Fuzzy search pattern for directories.

Configuration

goto allows you to customize its behavior using a configuration file. This file provides options to define default search settings and exclude specific directories from the results.


Config File Location

The configuration file is located at: ~/.goto_config.yaml

This file is optional. If it doesn’t exist, goto uses sensible defaults.


Config File Format

The configuration file is written in YAML format. Below is an example configuration:

maxDepth: <integer>
excludeDirs:
  - <string>
  - <string>

Available Options

Option Description Default
maxDepth Maximum search depth. 5
excludeDirs Directories to be excluded from the search. ".git", "node_modules"

Example Configuration

Here’s a complete example of a typical .goto_config.yaml file:

maxDepth: 5
excludeDirs:
  - build
  - dist
  - .cache

Developers Guide

This guide explains the architecture, key decisions, and trade-offs made during the development of goto.


Project Structure

Directory/File Description
cmd/main.go Entry point for the application.
cmd/pkg/search.go Logic for directory searching using find and fzf.
cmd/pkg/config.go Logic for dealing with user configurations.
setup.sh Shell integration setup script.
test/ Unit tests.

Key Decisions

1. Why Go?

2. Why find and fzf?

3. Configuration Format

4. Shell Integration Approach


Future Considerations


Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


[1.0.0] - TBD

Added

Coming soon!


Back