Skip to main content

activate

v0.38.0
danger

This feature is extremely experimental and may change based on feedback! If you run into any issues, please report an issue on GitHub or Discord.

The proto activate <shell> command will activate proto for the current shell session, by exporting environment variables and prepending PATH for each tool configured in the current directory. Activation is ran each time the current directory changes using a shell hook.

Arguments

  • <shell> - The shell to activate for.

Options

  • --export - Print the activate instructions in shell-specific syntax.
  • --json - Print the activate instructions in JSON format.
  • --no-bin - Do not include ~/.proto/bin when appending PATH.
  • --no-shim - Do not include ~/.proto/shims when prepending PATH.
  • --on-init - Trigger activation when initialized in the shell, instead of waiting for a cd/prompt change. v0.43.0

Caveats

  • Only tools that have a version configured in .prototools will be activated.
  • Tool versions configured in the global ~/.proto/.prototools are not included by default. Pass --config-mode all during activation to include them.
    • Do note that this will worsen performance depending on the number of tools.
  • Activation is only applied after changing directories and not when a new shell session is started, unless the --on-init argument is passed.

Setup

The following activation steps should be added after all environment variable and PATH modifications have happened in your shell, typically at the end of your shell profile.

warning

Any PATH modifications after proto activate will be lost when activation triggers. This happens because we take a snapshot of PATH when executed from your shell, and reset PATH on each activation to the snapshot. To avoid this problem, modify PATH before proto activate.

Bash

Add the following line to the end of your ~/.bashrc or ~/.bash_profile.

eval "$(proto activate bash)"

Elvish

Generate the hook:

proto activate elvish > ~/.elvish/lib/proto-hook.elv

Then add the following line to your ~/.elvish/rc.elv file.

use proto-hook

Fish

Add the following line to the end of your ~/.config/fish/config.fish.

proto activate fish | source

Murex

Add the following line to the end of your ~/.murex_profile.

proto activate murex -> source

Nu

Generate the hook:

proto activate nu > ~/.config/nushell/proto-hook.nu

Then add the following line to your ~/.config/nushell/config.nu file.

use proto-hook.nu

Pwsh

Add the following line to the end of your profile ($PROFILE).

Invoke-Expression "$(proto activate pwsh)"

Zsh

Add the following line to the end of your ~/.zshrc.

eval "$(proto activate zsh)"