A cross-platform CLI tool to save and jump to directories quickly.
sudo mv gotocli /usr/local/bin/Move gotocli.exe to C:\Program Files\gotocli\
function goto() {
local command=$1
local name=$2
local path=$3
local extra=$4
if [ "$command" = "jump" ]; then
TARGET=$(/usr/local/bin/gotocli goto jump "$name" 2>/dev/null)
if [ -z "$TARGET" ]; then
echo "No directory found for '$name'"
else
cd "$TARGET"
fi
elif [ "$command" = "edit" ]; then
/usr/local/bin/gotocli goto edit "$name" "$path"
elif [ "$command" = "rename" ]; then
/usr/local/bin/gotocli goto rename "$name" "$path"
else
/usr/local/bin/gotocli goto "$command" "$name" "$path" "$extra"
fi
}function goto {
param($command, $name, $path, $extra)
if ($command -eq "jump") {
$TARGET = & "C:\Program Files\gotocli\gotocli.exe" goto jump $name 2>$null
if (-not $TARGET) {
Write-Host "No directory found for '$name'"
} else {
Set-Location $TARGET
}
} elseif ($command -eq "edit") {
& "C:\Program Files\gotocli\gotocli.exe" goto edit $name $path
} elseif ($command -eq "rename") {
& "C:\Program Files\gotocli\gotocli.exe" goto rename $name $path
} else {
& "C:\Program Files\gotocli\gotocli.exe" goto $command $name $path $extra
}
}goto add <name> <path>
# Example
goto add projects /home/user/projectsgoto listgoto jump <name>
# Example
goto jump projectsgoto remove <name>
# Example
goto remove projectsgoto edit <name> <newpath>
# Example
goto edit projects /home/user/new-projectsgoto rename <oldname> <newname>
# Example
goto rename projects work-projects| Command | Usage | Action |
|---|---|---|
goto add |
goto add <name> <path> |
Save a directory |
goto list |
goto list |
List all saved directories |
goto jump |
goto jump <name> |
Jump to a directory |
goto remove |
goto remove <name> |
Remove a saved directory |
goto edit |
goto edit <name> <newpath> |
Update a directory path |
goto rename |
goto rename <oldname> <newname> |
Rename a saved directory |
- The Go binary (
gotocli) handles all data storage and retrieval, saving directories to~/.goto.json - The shell wrapper (
goto) intercepts thejumpcommand and runscdin the current shell - This is the same pattern used by popular tools like
zandautojump
MIT