Repository navigation
Shell Integration
Every crower command, a command of its own β in bash, zsh, fish, PowerShell and cmd.
deploy # instead of: crower deployNothing to do. The installers (install.sh, add_to_path.sh,
add_to_path.bat) run crower init --all, which sets up every shell on the
machine. On a machine set up another way, the first time you run crower in a
shell without the hook it asks once:
crower: set up zsh so commands like "cd" work in this terminal? It adds one line to zsh's startup. [Y/n]
Enter sets it up; n is remembered for that shell (~/crower/shell-setup.json).
It never asks a script (stdin and stderr must be terminals), inside the hook, or
when CROWER_NO_SETUP is set. Either way, open a new terminal once afterwards β
a window that is already running cannot load it by itself.
| Command | Does |
|---|---|
crower init --apply |
set up the shell you run it from |
crower init --all |
set up every installed shell (bash, zsh, fish; cmd, Windows PowerShell, PowerShell 7) |
crower init |
show what the current shell needs |
PowerShell is asked where its profile is ($PROFILE), so Windows PowerShell 5.1,
PowerShell 7 and a OneDrive-redirected Documents folder all work. When the
execution policy blocks profile scripts (Restricted, the 5.1 default), crower
offers to set RemoteSigned for your user β scripts written on this computer
run, downloaded ones must be signed.
By hand:
| Shell | File | Line |
|---|---|---|
| bash | ~/.bashrc |
eval "$(crower init bash)" |
| zsh | ~/.zshrc |
eval "$(crower init zsh)" |
| fish | ~/.config/fish/config.fish |
crower init fish | source |
| PowerShell (5.1 and 7) | $PROFILE |
crower init powershell | Out-String | Invoke-Expression |
| cmd.exe | β | see cmd.exe below |
--apply writes a guarded form (command -v crower β¦ && eval β¦), so a shell
without crower installed still starts cleanly.
- β One alias per name and alias.
crower create greet "echo hi" -a higives yougreetandhi. Arguments pass through untouched βgreet -x 'two words'runscrower execute greet -- -x 'two words'. - π Jumps folders. A command that is only
cd <folder>moves the terminal you typed it in βcrower create desk "cd /mnt/c/Users/me/Desktop"thendesk,cr deskorcr execute desk. A cd run bycrower executehappens in a child process and is lost, so for these the hook runs crower first (the run is still counted, and a missing folder stops the jump) and then changes folder in your shell:cdin bash, zsh and fish,Set-Locationin PowerShell,cd /din cmd. The folder must be absolute or start with~, written as one word (quote it if it has spaces);cd /dandchdirare accepted. A line with anything more βcd /app && git pull,cd $DIR,cd srcβ runs as before.cr <name>follows crower's own rule: a name that is also a subcommand (list,create, β¦) runs the subcommand, so usecr execute <name>. - π Runs here, when you ask. A command created or updated with
--hereruns in your own shell:crower create venv "source .venv/bin/activate" --herethenvenv,cr venvorcr execute venvleaves the venv active. crower fills in the parameters and records the run (crower execute <name> --emit, which the hook calls), and the shell evaluates the line:evalin bash, zsh and fish,Invoke-Expressionin PowerShell,for /f β¦ do callin cmd. Without the hook β a script, the window,crower executeitself β the command runs as a subprocess like any other. Write the line for the shell you run it in;exitin it closes that shell. In fish and PowerShell a plain variable stays local to the hook's function: useset -g/$global:, whilecdand environment variables (export,$env:) always reach the shell. - π‘οΈ Never shadows. If the shell already knows the name β a program on
PATH, a builtin or keyword, your own alias or function β crower skips it. A command namedlsorgitstays reachable ascr ls. - π Stays in sync. The hook wraps
crowerandcr: aftercreate,update,delete,import,revert,restore,resetorsetup, the aliases are rebuilt in that shell β a new command works on the next line, a deleted one is gone. - β¨οΈ Completes.
cr <Tab>,crower execute <Tab>,update,deleteandexportoffer command names; zsh, fish and PowerShell show each one's description (or the line it runs). - πͺΆ Costs one process at shell start β a few milliseconds β and never checks for updates.
Names the hook can define: letters, digits, _ . + -, not starting with -.
crower and cr themselves are reserved.
cmd has no startup script, so the hook is a doskey macro file that cmd's
AutoRun loads. Setting up cmd (the question, init --apply from cmd, or
init --all) writes %USERPROFILE%\crower\crower.doskey and adds
doskey /macrofile="β¦" & set "CROWER_HOOK=cmd" to
HKCU\Software\Microsoft\Command Processor\AutoRun, after any value that was
already there.
The file defines cr and crower macros: cr desk changes folder or runs
--here in the window, every other cr β¦ line goes to the program, and then the
macro reloads the file β crower rewrites it after create, update, delete
and the other changes, so a new command works in the same window. A first or second word that contains a double quote
(cr "my cmd") confuses cmd's if; use the bare name there.
type deploy # bash/zsh: "deploy is aliased to `command crower execute deploy --'"
crower init zsh | head # see exactly what the hook defines| Symptom | Cause |
|---|---|
deploy: command not found right after create in a script |
Aliases apply to lines read after they are defined; in an interactive shell the next prompt has it. |
echo y | crower delete x keeps the alias (bash) |
A function at the end of a pipe runs in a subshell; run it without the pipe. zsh is unaffected. |
| crower says "only the shell hook can do" | This window has no hook: it predates the setup (open a new one), or the shell was never set up (crower init --apply). |
A cd command runs but the folder does not change |
The hook is not loaded (type cr should say it is a function; in cmd, doskey /macros should list cr=), the terminal predates the command's change (exec $SHELL), or the line is not a plain cd <absolute folder> β see "Jumps folders" above. The program on its own can never move your terminal. |
not an in-shell command β¦ from a name |
The command lost --here in another terminal or through a pipe, and this shell's hook is stale. Open a new terminal. |
| A command is not defined | Its name is already taken in the shell β type <name> shows by what. Use cr <name>. |
| zsh: no completion |
compinit must run before the hook line. |
init Β· import Β· β‘ Quick start Β· π Commands
Β© 2025 Felipe Inoue Β· crower is MIT licensed Β· third-party notices