#cd #jump #file #coreutils #filesystem #command-line-tool

app jumb

A lightning-fast CLI tool for directory navigation. Create custom shortcuts to instantly jump between frequently used paths, eliminating the need for lengthy cd commands.

4 releases

0.1.3 Jun 22, 2024
0.1.2 Jun 22, 2024
0.1.1 Jun 22, 2024
0.1.0 Jun 22, 2024

#119 in Command line utilities

Download history 269/week @ 2024-06-22

269 downloads per month

MIT license

16KB
227 lines

Jumb: Simplify Directory Navigation

How many times do you run the cd command in a day? If you're like many developers, it's probably more than you'd like to count.

Friendship ended with X, now Y is my best friend

Jumb is a command-line tool that simplifies directory navigation by allowing users to create shortcuts for frequently accessed directories. This reduces the need for lengthy cd commands, saving time and streamlining workflow.

Key Benefits

  • Reduce cd Usage: Minimize the need to use lengthy cd commands by setting up shortcuts to your most used directories.
  • Save Time: Dramatically reduce the time spent navigating between different parts of your file system, enhancing productivity, especially for developers and system administrators.
  • Streamline Workflow: Improve your workflow efficiency by quickly switching contexts between projects and directories.

Prerequisites

Before installing Jumb, ensure you have the following installed on your system:

  • Git: Required to clone the repository if not installing via Cargo.
  • Rust and Cargo: Jumb is built with Rust, so you'll need Rust and Cargo installed to compile and install it directly from the source or via Cargo. Install them from the official Rust site.

Installation

Using Cargo

Install Jumb directly from Cargo:

cargo install jumb

NOTE: After installing Jumb with Cargo, it's essential to wrap it with a shell script to make the tool work properly.

Setting Up the Shell Wrapper

Integrate Jumb with your shell by adding a shell wrapper to your .zshrc or .bashrc file. This wrapper ensures that using Jumb feels like a natural extension of your shell commands.


# Jumb tool wrapper
function jnav() {

    unalias jumb 2>/dev/null
    unset -f jumb 2>/dev/null

    # Find the path to the 'jumb' executable dynamically
    local jumb_path=$(which jumb)
    if [[ -z "$jumb_path" ]]; then
        echo "The 'jumb' command is not installed or not in PATH."
        return 1  # Exit the function with an error status
    fi


    # Check if the command is 'view' without additional arguments
    if [[ "$1" == "view" ]] && [[ $# -eq 1 ]]; then
        # This should only list the directories, not change to any directory
        $jumb_path view
    elif [[ $# -eq 1 ]]; then
        # Assuming any single argument not prefixed by 'view' is a path name
        local dir=$($jumb_path "$1")
        if [[ -d "$dir" ]]; then
            cd "$dir"
        else
            echo "Directory not found: $dir"
        fi
    else
        # Handle other commands or multiple arguments normally
        $jumb_path "$@"
    fi
}


Why Use jnav Instead of jumb?

The jnav function is used instead of directly invoking jumb to avoid any potential conflicts with the binary name. This function ensures that the shell correctly handles the custom functionality provided by Jumb, such as managing and navigating to directory shortcuts.

Customizing Function Name

If you prefer a different name for the function, replace jnav with your chosen name to prevent potential conflicts with the Jumb binary.

Usage

Set up and manage your directory shortcuts easily:

  • Add a Shortcut
jnav add shortcut_name absolute/path/to/directory

For example, if you want to add the current directory path, then you can run the command with a full stop to add the current dir.

jnav add project .
  • Navigate quickly using:
jnav shortcut_name
  • Remove a Shortcut
jnav remove shortcut_name
  • View All Shortcuts
jnav view
  • View particular shortcut path
jnav view <Shortcut_name>

Contributing

Contributions are encouraged. Feel free to fork the project and submit pull requests.

Dependencies

~2–12MB
~104K SLoC