@brechtknecht/drive
v1.0.1
Published
A terminal utility to bookmark and quickly navigate to frequently used directories
Maintainers
Readme
Drive
A terminal utility to bookmark and quickly navigate to frequently used directories.
Note: The npm package is called @brechtknecht/drive (install with npm install -g @brechtknecht/drive), but the command you use is just drive.
Features
- Bookmark & Select: Park frequently-used directories with
drive park, then navigate via interactive TUI with keyboard shortcuts (↑/↓ to browse, Enter to select,dto delete, Esc to cancel) - Flexible Actions: Jump to directories (
drive), execute commands in them (drive npm test), open in editor (drive -e), or quickly go home (drive home) - all from one selector interface - Persistent & Reliable: Bookmarks stored in
~/.config/drive/paths.json, automatically filters invalid paths, works via shell wrapper for seamless directory changing
Installation
Install globally via npm:
npm install -g @brechtknecht/driveImportant: After installation, you'll see instructions to add a shell wrapper to your ~/.bashrc or ~/.zshrc. This is required for the cd functionality to work. Copy the source line shown in the postinstall output and add it to your shell config, then reload your shell.
Example for zsh:
# Add to ~/.zshrc:
source /path/to/global/node_modules/@brechtknecht/drive/drive.sh
# Then reload:
source ~/.zshrcUsage
Park a directory
Bookmark the current directory:
drive parkNavigate to a bookmarked directory
Launch the interactive TUI selector:
driveKeyboard shortcuts:
- ↑/↓ arrows - Navigate through the list
- Enter - Navigate to the selected directory
- d - Delete the currently highlighted bookmark
- Esc - Cancel and exit
Pressing 'd' will immediately delete the highlighted directory from your bookmarks and refresh the list, allowing you to delete multiple bookmarks in one session.
Quick navigation to home
Jump to your home directory quickly:
drive homeList all bookmarked directories
drive listRemove a bookmark
You can remove bookmarks in two ways:
- From the main selector: Run
drive, navigate to a directory with arrow keys, and pressdto delete it - Using the unpark command:
This will show an interactive selector to choose which bookmark to remove.drive unpark
Open in editor
Open a bookmarked directory in your editor (uses $EDITOR, $VISUAL, or defaults to code):
drive --editor
# or
drive -eExecute commands in selected directories
Run any command in a directory you select from your bookmarks:
drive <command>Examples:
# Launch claude in a selected project
drive claude
# Install dependencies in a selected project
drive npm install
# Run tests in a selected project
drive npm test
# Open VS Code in a selected directory
drive code .
# Complex commands work too
drive npm install && npm startHow it works:
- Shows the directory selector
- After you select a directory, it changes to that directory
- Then executes your command in that directory
This is perfect for quickly running commands in your frequently used projects without navigating there first.
How it works
The drive command uses a shell wrapper function to enable directory changing. When you select a directory:
- The Node.js CLI outputs the selected path
- The shell wrapper function reads this output
- It then executes
cdto change to that directory
For commands like park, list, and unpark, the wrapper passes them directly to the CLI without any cd magic.
Configuration
Bookmarks are stored in: ~/.config/drive/paths.json
The config file is a simple JSON array of absolute paths:
{
"paths": [
"/Users/you/projects/important-project",
"/Users/you/Documents"
]
}Uninstall
- Remove the source line from your shell config (
~/.bashrcor~/.zshrc) - Uninstall the package:
npm uninstall -g @brechtknecht/drive - Optionally, remove your bookmarks:
rm -rf ~/.config/drive
Development
Run without building
npm run dev parkBuild
npm run buildTech Stack
License
MIT
