try
Lightweight, time‑sensitive directory navigation for experiments — a fast way to jump between temporary project folders.
Inspired by and adapted from Tobias Lütke's original Ruby tool: https://github.com/tobi/try
Quick Start
One-line install (Linux/macOS):
|
Then restart your shell and run try to get started!
Why try?
When experimenting you often create throwaway directories (e.g.,
2025-08-21-test-feature-x, tmp-viz-poc). Finding and jumping back to them
slows you down. try gives you an interactive, fuzzy selector that favors what
you touched most recently, and creates a new directory when your query doesn’t
exist — all wired to actually cd your shell.
Features
- Interactive fuzzy finder: fast, incremental filtering of your tries.
- Time‑sensitive scoring: boosts recently created or visited dirs.
- Instant creation: press Enter to create when no exact match.
- Git clone integration:
try clone <url>or pass a git URL totryto clone into a date‑prefixed dir. - One‑key deletion: Ctrl‑D, with an explicit “YES” confirmation.
- Shell integration: prints
cdcommands your shell evaluates. - Native speed: single‑binary CLI written in Rust.
Installation
Recommended: Quick Install Script (Linux/macOS)
|
This script will:
- Detect your OS (Linux/macOS) and architecture (x86_64/aarch64/armv7)
- Download the latest pre-built binary from GitHub releases
- Extract and install it to
~/.local/bin - Check if
~/.local/binis in your PATH (warns if not) - Automatically add shell integration to your rc file (bash/zsh/fish)
After installation, restart your shell or source your rc file to start using try.
To skip automatic shell integration:
|
For help:
|
From Pre-built Binaries
Download the latest release for your platform from the releases page, extract it, and place the binary in your PATH.
From crates.io
If you have Rust installed:
From Source
Prerequisites: a working Rust toolchain from https://rustup.rs
Or build a release binary: cargo build --release → target/release/try
Shell Integration
If you used the install script, shell integration is already configured! Just restart your shell.
If you installed via another method, add the following to your shell configuration:
bash/zsh:
# add to ~/.bashrc or ~/.zshrc
fish:
# add to ~/.config/fish/config.fish
eval "$(try init | string collect)"
Then reload your shell:
Customize the storage location (default: ~/src/tries) either by passing an
absolute path to init or by setting TRY_PATH. You can also override
per‑invocation with the global --path option:
# or
# or override at call time
Usage
Basic:
# Open the selector (with shell function installed)
# Clone a git repo into a date-prefixed directory and cd into it
# Shorthand: passing a git URL to `try` behaves like `try clone`
Inside the selector:
- Up/Down or Ctrl‑P/Ctrl‑N: move selection
- Type: filter entries
- Enter: select existing or create
YYYY-MM-DD-<query>and cd - Ctrl‑D: delete the selected directory (requires typing
YESto confirm) - Esc/Ctrl‑C: cancel and return to the shell
Notes:
- If there’s no matching directory, Enter creates one (prefixed by
YYYY-MM-DD-) and jumps into it. - Ranking combines fuzzy score with recency to surface likely targets.
- Query terms that start with a hyphen must be placed after
--so they aren’t parsed as flags, for example:try cd -- --foo --bar. With the shell function installed, use:try -- --foo.
Deletion semantics
- Ctrl‑D prompts for confirmation; type
YESto permanently delete the selected directory. - File count and size are displayed before confirmation.
- Operations are restricted to the configured tries root; entries outside are never touched.
CLI Reference
try(with no args): open the selector.try --help: show top‑level help (lists subcommands and global options).try init [--path PATH] [PATH]: print the shell function; add it to your rc file.try cd [QUERY...] [--path PATH]: launch selector and print thecd/mkdir/touch commands (used by the shell function).try clone <git-uri> [name] [--path PATH]: print a clone pipeline (mkdir -p, git clone, touch, cd) into the tries directory.- Shorthand:
try <git-uri>behaves liketry clone <git-uri>. - Subcommand help:
try cd --help,try init --help,try clone --help.
Configuration
- Default tries directory:
~/src/tries - Override via
TRY_PATHenv var or an absolute path argument totry init
Troubleshooting
command not found: try: ensure~/.cargo/binis on yourPATHor reference the binary directly, e.g.eval "$(~/.cargo/bin/try init)".- Selector opens but no
cdhappens: confirm your rc file sources theinitfunction and that you restarted/reloaded the shell. - Wrong tries location: check
echo $TRY_PATHor the path passed toinit.
Development
- Build:
cargo build(orcargo build --release) - Run:
cargo run -- [args](e.g.,cargo run -- cd foo) - Test:
cargo test --all --locked - Lint:
cargo clippy --all-targets -- -D warnings - Format:
cargo fmt --all
Architecture: single‑binary CLI using crossterm for TUI, dirs for home
paths, and unicode-width for display width.
Colors
- Help and error output from
clapuses its built‑in color logic (color: auto) and respects standard environment conventions. try’s own warnings and errors are styled on stderr when appropriate and degrade to plain text when not:- Colors enabled only if stderr is a TTY.
NO_COLORdisables colors.CLICOLOR=0disables;CLICOLOR_FORCE!=0forces enable.
- When output is piped or redirected, styling is disabled to avoid ANSI sequences in logs.
Error Handling
- Internally, the app uses a small, typed error (
thiserror) at high‑level boundaries and returns plainio::Errorfor low‑level file operations. - The selector and CLI keep a lenient UX: non‑critical issues print a warning and continue; critical issues surface clearly and set a non‑zero exit where appropriate.
Security & Behavior
trywrites only under the configured tries directory (default~/src/tries).- No network access or secrets required.
License
MIT — see LICENSE.
Contributing
See CONTRIBUTING.md for workflow and PR expectations, and AGENTS.md for structure, commands, style, and testing guidelines.