try

module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: MIT

README

try - Temporary Project Directory Manager

A Go implementation of the try CLI tool for managing temporary project directories, with full feature parity to the original Ruby version.

Features

  • Interactive TUI: Fuzzy search and navigate your try directories with a beautiful terminal interface
  • Smart Search: Fuzzy matching with intelligent scoring based on recency and naming patterns
  • Date Prefixes: Automatically prefix directories with YYYY-MM-DD- for easy organization
  • Directory Operations: Create, rename, and delete try directories
  • Git Integration: Clone repositories and create worktrees directly into try directories
  • Shell Integration: Seamless cd navigation through shell wrapper functions
  • Cross-Platform: Works on macOS, Linux, and Windows

Installation

Using Go Install
go install github.com/bscott/try/cmd/try@latest
From Source
git clone https://github.com/bscott/try.git
cd try
go build -o try ./cmd/try
sudo mv try /usr/local/bin/

Quick Start

  1. Initialize shell integration:
# For bash/zsh (add to ~/.bashrc or ~/.zshrc)
eval "$(try init)"

# For fish (add to ~/.config/fish/config.fish)
try init | source
  1. Use the TUI:
# Launch interactive TUI
try

# The TUI opens with fuzzy search - just start typing!

Usage

Commands
  • try - Launch interactive TUI
  • try init [path] - Generate shell integration script
  • try exec - Execute TUI and output shell command (used by wrapper)
Keyboard Shortcuts
Navigation
  • ↑/↓ or Ctrl+P/N - Move selection up/down
  • Enter - Select entry and navigate to directory
Search Input
  • Ctrl+A - Move cursor to start
  • Ctrl+E - Move cursor to end
  • Ctrl+B - Move cursor back one character
  • Ctrl+F - Move cursor forward one character
  • Ctrl+K - Kill to end of line
  • Ctrl+W - Delete word backward
  • Backspace - Delete character backward
Actions
  • Ctrl+D - Toggle delete mode / mark entry for deletion
  • Ctrl+R - Rename selected entry
  • Ctrl+T - Create new try directory
  • Ctrl+H - Show help
  • Esc - Cancel current action / return to normal mode
  • Ctrl+C - Quit
Delete Flow
  1. Press Ctrl+D to enter delete mode
  2. Press Ctrl+D again to mark/unmark entries (✗ indicator appears)
  3. Press Enter to show confirmation prompt
  4. Type YES exactly to confirm deletion
  5. Press Esc to cancel at any point
Create Flow
  1. Press Ctrl+T to open create prompt
  2. Enter name (without date prefix)
  3. Press Enter to create
  4. Directory is created as YYYY-MM-DD-{name} and you're navigated to it
Rename Flow
  1. Select entry and press Ctrl+R
  2. Edit the name (date prefix is preserved)
  3. Press Enter to confirm or Esc to cancel

Configuration

Environment Variables
  • TRY_PATH - Base directory for try directories (default: ~/src/tries)

Example:

export TRY_PATH="$HOME/experiments"
eval "$(try init)"

Git Integration

Clone repositories directly into try directories:

try clone https://github.com/user/repo.git

Create worktrees:

try worktree feature-branch

Fuzzy Matching Algorithm

The fuzzy matcher uses intelligent scoring:

  1. Recency: Newer directories score higher
  2. Date Prefix Bonus: Entries with YYYY-MM-DD- prefix get +10 points
  3. Character Matches: +1 per matched character
  4. Word Boundaries: +1 for matches at word start
  5. Proximity: Closer matches score higher
  6. Density: Tighter match spans score higher
  7. Length Penalty: Shorter names score slightly higher

Empty queries show all entries sorted by modification time (newest first).

Project Structure

try/
├── cmd/try/              # Main entry point
│   ├── main.go
│   ├── exec.go           # TUI launcher
│   └── init.go           # Shell integration
├── internal/
│   ├── config/           # Configuration management
│   ├── tries/            # Directory operations
│   ├── fuzzy/            # Fuzzy matching algorithm
│   ├── tui/              # Bubble Tea TUI
│   ├── git/              # Git operations
│   └── shell/            # Shell integration
└── README.md

Development

Running Tests
go test ./...
Building
go build -o try ./cmd/try

License

MIT License - see LICENSE file for details

Credits

Directories

Path Synopsis
cmd
try command
internal
fuzzy
Package fuzzy implements fuzzy matching and ranking for directory entries.
Package fuzzy implements fuzzy matching and ranking for directory entries.
git
Package git provides utilities for working with Git repositories.
Package git provides utilities for working with Git repositories.
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL