Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,25 @@ Alternatively, disable Windows Terminal's alias (Settings → Privacy & security
paru worktrunk-bin && wt config shell install
```

<details>
<summary><strong>Script installer (experimental)</strong></summary>

Downloads a static binary — no package manager required.

**macOS & Linux:**

```bash
curl -fsSL https://worktrunk.dev/install.sh | sh
```

**Windows:**

```bash
powershell -c "irm https://worktrunk.dev/install.ps1 | iex"
```

</details>

## Quick start

Create a worktree for a new feature:
Expand Down
19 changes: 19 additions & 0 deletions docs/content/worktrunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,25 @@ Alternatively, disable Windows Terminal's alias (Settings → Privacy & security
paru worktrunk-bin && wt config shell install
```

<details>
<summary><strong>Script installer (experimental)</strong></summary>

Downloads a static binary — no package manager required.

**macOS & Linux:**

```bash
curl -fsSL https://worktrunk.dev/install.sh | sh
```

**Windows:**

```bash
powershell -c "irm https://worktrunk.dev/install.ps1 | iex"
```

</details>

## Quick start

Create a worktree for a new feature:
Expand Down
28 changes: 28 additions & 0 deletions docs/static/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Worktrunk Installer (Windows)
# https://worktrunk.dev/install.ps1

if ($IsWindows -eq $false -and $PSVersionTable.PSVersion.Major -ge 6) {
Write-Host "Non-Windows environment detected. Please use the shell installer instead:" -ForegroundColor Yellow
Write-Host " curl -fsSL https://worktrunk.dev/install.sh | sh"
exit 1
}

Write-Host "Installing worktrunk..."
irm https://github.com/max-sixty/worktrunk/releases/latest/download/worktrunk-installer.ps1 | iex

# Update PATH to pick up the newly installed binary.
# Respect CARGO_HOME if set, otherwise use the default location.
$cargoBin = if ($env:CARGO_HOME) { "$env:CARGO_HOME\bin" } else { "$HOME\.cargo\bin" }
if ($env:Path -notlike "*$cargoBin*") {
$env:Path += ";$cargoBin"
}

if ((Get-Command wt -ErrorAction SilentlyContinue) -and (wt --version 2>&1 | Select-String 'worktrunk')) {
wt config shell install
} elseif (Get-Command git-wt -ErrorAction SilentlyContinue) {
git-wt config shell install
} else {
Write-Host ""
Write-Host "Warning: worktrunk installed but neither 'wt' nor 'git-wt' found in PATH." -ForegroundColor Yellow
Write-Host "Restart your shell and run 'wt config shell install' (or 'git-wt config shell install') manually."
}
50 changes: 50 additions & 0 deletions docs/static/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
set -eu

# Worktrunk Installer (Unix)
# https://worktrunk.dev/install.sh

if [ "${OS:-}" = "Windows_NT" ]; then
echo "Windows detected. Please use the PowerShell installer instead:"
echo " powershell -c \"irm https://worktrunk.dev/install.ps1 | iex\""
exit 1
fi

echo "Installing worktrunk..."

# Download to a temp file instead of piping curl to sh. This avoids two issues:
# 1. Pipe swallows curl failures (pipefail is not POSIX)
# 2. Piping consumes stdin, blocking interactive prompts in the installer
installer="$(mktemp)"
trap 'rm -f "$installer"' EXIT
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/latest/download/worktrunk-installer.sh -o "$installer" || {
echo "Download failed."
exit 1
}
sh "$installer" || {
echo "Installation failed."
exit 1
}

# Source the cargo env to pick up PATH changes from the installer.
# This handles custom CARGO_HOME and avoids hardcoding ~/.cargo/bin.
# shellcheck disable=SC1091
. "${CARGO_HOME:-$HOME/.cargo}/env" 2>/dev/null || true

if ! command -v wt >/dev/null 2>&1; then
echo ""
echo "Warning: worktrunk installed but 'wt' not found in PATH."
echo "Restart your shell and run 'wt config shell install' manually."
exit 0
fi

# Configure shell integration. We use < /dev/tty to ensure the interactive
# prompt can read from the terminal even when this script was piped into sh
# (e.g. curl ... | sh).
if [ -e /dev/tty ]; then
wt config shell install < /dev/tty
else
echo ""
echo "Non-interactive environment detected."
echo "Run 'wt config shell install' after restarting your shell."
fi
Loading
Loading