中文文档请见 docs/README_CN.md。
try-rs is a Rust port of the popular try tool. It is a command-line utility designed to help you easily manage and navigate temporary "sandbox" directories for experiments, keeping your main projects clean.
It features a fast TUI, fuzzy searching, Git integration, and multi-workspace management.
- ⚡ Fast TUI: Interactive interface built with
crossterm. - 🔍 Fuzzy Search: Quickly find existing experiments or create new ones.
- 📅 Date Suffix: Directory names are automatically suffixed with the date (e.g.,
my-experiment-2025-12-16), so experiments stay sorted and easy to tell apart over time. - 🌐 Proxy Support: Clone through a proxy tool (e.g.
proxychains) via the--proxyoption or theTRY_PROXYenvironment variable — handy when GitHub is slow or blocked. - 📦 Git Integration: Easily clone repos into isolated, dated directories.
- 🗂️ Workspace Management: Switch between different root directories (workspaces) using
try set, with current directory prioritized. - 🪟 Cross-Platform: Works on Linux, macOS, and Windows. The shell is auto-detected and the right script (Bash/Zsh or PowerShell) is emitted automatically.
You need Rust and Cargo installed on your system.
git clone <this-repo-url>
cd try-rs
cargo build --releaseThe binary will be located at ./target/release/try.
Since try needs to change your shell's current directory (cd), it cannot work as a standalone binary alone. You must configure your shell to wrap it.
Add the following to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc):
# Replace /path/to/try-rs with the actual path to your compiled binary
eval "$(/path/to/try-rs/target/release/try init ~/experiments)"~/experimentsis the default directory where your "tries" will be stored. You can change this to any path you prefer.
After adding this, restart your terminal or run source ~/.zshrc.
try emits PowerShell-native scripts on Windows. Add the following to your PowerShell profile ($PROFILE):
# Replace the path with the actual path to your compiled try.exe
& 'C:\path\to\try-rs\target\release\try.exe' init --shell powershell 'C:\Users\you\experiments' | Out-String | Invoke-ExpressionReload with . $PROFILE (or restart the terminal). Windows Terminal is recommended for the best TUI experience.
Out-Stringis required: the init output is multi-line, and without it PowerShell passes a string array toInvoke-Expression, which fails with "Cannot convert 'System.Object[]' to the type 'System.String'". Pinning--shell powershellalso avoids mis-detection when PowerShell is launched from a parent shell that exports$SHELL(e.g. Git Bash).
The PowerShell command is
tr, nottry.tryis a reserved keyword in PowerShell (try { } catch { }), so the wrapper cannot be namedtry— typingtrywould be parsed as atry{}statement and never reach the tool. Usetrinstead (e.g.tr,tr my-idea,tr clone <url>). To pick a different name, pass--name <cmd>toinit.
The shell is auto-detected. To force a specific shell, pass
--shell bashor--shell powershelltoinit. The init wrapper exportsTRY_SHELL, so all subsequent invocations emit scripts for the correct shell automatically.
Simply type try to open the interactive selector:
try- Type to filter directories.
- Up/Down to navigate.
- Enter to switch to the selected directory.
- Delete to mark a directory for deletion (Batch delete supported).
- Esc to cancel.
Type a name that doesn't exist, and select "Create new":
try my-new-ideaThis will create ~/experiments/my-new-idea-YYYY-MM-DD and cd into it.
Clone a repository into a fresh, dated directory:
try clone https://github.com/user/repo.gitThis creates repo-YYYY-MM-DD and clones the source into it.
Proxy Support: If you need to use a proxy tool (like proxychains or similar) for cloning:
# Use --proxy option
try clone https://github.com/user/repo.git --proxy proxychains
# Or set TRY_PROXY environment variable
export TRY_PROXY=proxychains
try clone https://github.com/user/repo.gitThe CLI option takes precedence over the environment variable.
try-rs allows you to manage multiple root locations (workspaces) for your experiments.
-
Add a new workspace: Initialize a new path. This switches your current session to this path and saves it to history.
# This sets the current TRY_PATH and adds it to history try init ~/other/projects
-
Switch workspaces: Use
setto choose from your previously used workspaces.try setThis opens a TUI listing your workspace history, with the current working directory prioritized at the top. Selecting a workspace will:
- Update your
TRY_PATHenvironment variable - Change to the selected directory (
cd) - Save it to your workspace history
- Update your
- History: Workspace history is stored in
~/.config/try/workspaces(Linux/macOS) or%USERPROFILE%\.config\try\workspaces(Windows). - Environment: The tool relies on the
TRY_PATHenvironment variable, which is managed by the shell wrapper.
MIT