A Go implementation of the Ruby try utility for quickly creating and navigating to temporary project folders.
Note: A child process cannot change the parent shell's directory, so shell integration is required. This is the same approach used by tools like zoxide, autojump, and z.
- Create dated folders:
try some namecreates~/try/2025-10-09-some-name - Fuzzy search: Automatically finds and navigates to existing folders based on name (using sahilm/fuzzy)
- Interactive selector: When multiple matches are found, shows an interactive menu with top 3 matches and "create new" option
- Informative output: Displays folder name, creation date, and usage count when navigating
- Tracks usage: SQLite database tracks folder creation dates, open count, and last opened time
- Smart sorting: Results sorted by fuzzy match score, usage frequency, and last opened time
- List/search folders:
try listshows recent folders, andtry list apifilters with fuzzy search - Prune stale entries: Deleted folders are pruned automatically by default, and
try prunecan run cleanup manually - Configurable behavior: use the interactive
try configeditor,~/.config/try/config, or environment variables to adjust storage and pruning
Install using Go:
go install github.com/ACPixel/try@latestOr clone and build locally:
git clone https://github.com/ACPixel/try.git
cd try
go installAfter installing, run:
try initThis will output shell integration code. Add it to your ~/.bashrc or ~/.zshrc:
try init >> ~/.bashrc
source ~/.bashrcOr manually add:
try() {
local output
# Only capture stdout for cd command, let stderr through for interactive prompts
output=$(command try "$@" 2>/dev/tty)
if [ $? -eq 0 ]; then
eval "$output"
else
return 1
fi
}After adding the alias, simply run:
# Create a new folder and cd into it
try my-project
# Creates: ~/try/2024-01-15-my-project and changes directory
# Later, fuzzy search will find it and cd into it
try my-proj
# Navigates to: ~/try/2024-01-15-my-project
# Output: ✓ my-project (2024-01-15, opened 2 times)
# If multiple matches are found, an interactive selector appears
try project
# Shows interactive menu with top 3 matches:
# > project-a (2024-01-10, opened 5 times)
# project-b (2024-01-12, opened 3 times)
# project-c (2024-01-14, opened 1 times)
# Create new: project
# List recent tries
try list
# Fuzzy-filter the list
try list proj
# Clean up database records for deleted folders
try prune
# Edit config interactively
try config
# Show active config and config file location
try config showBy default, try stores folders and its SQLite database under ~/try. It also prunes database records for manually deleted folders on every use.
Run try config to edit settings interactively. You can also create ~/.config/try/config manually:
try_dir = "~/try"
prune_on_use = true
Environment variables override the config file, which is useful for one-off commands or scripts:
export TRY_DIR="$HOME/work/tries"
export TRY_PRUNE_ON_USE=false- The Go binary searches the database for existing folders matching your query using fuzzy search
- If a single match is found, it displays folder info, updates usage stats, and outputs
cd "path" - If multiple matches are found, it shows an interactive selector with the top 3 matches and a "create new" option
- If no match is found, it creates a new dated folder with a normalized slug and outputs
cd "path" - The shell function wraps the binary and
evals the output to change directory - Folder information (name, date, usage count) is displayed in gray with a checkmark for easy identification
- The database schema is versioned with
schema_migrations; databases without that table are treated as v0 and migrated automatically
# Clone the repository
git clone https://github.com/ACPixel/try.git
cd try
# Install to $GOPATH/bin (or $HOME/go/bin if GOPATH is not set)
go install
# Or build locally
go build -o try main.goThe SQLite database is stored at ~/try/try.db and tracks:
- Folder paths
- Names
- Creation dates
- Times opened
- Last opened timestamp
- Schema version