Back to Moon

activate

website/docs/proto/commands/activate.mdx

2.2.42.5 KB
Original Source

import VersionLabel from '@site/src/components/Docs/VersionLabel';

<VersionLabel version="0.38.0" header />

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.

:::info

Learn more about shell activation in the official workflow documentation!

:::

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.
  • --no-init - Do not trigger activation when initialized in the shell, and instead wait for a cd/prompt change. <VersionLabel version="0.50.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.

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.

Bash

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

shell
eval "$(proto activate bash)"

Elvish

Generate the hook:

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

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

shell
use proto-hook

Fish

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

shell
proto activate fish | source

Murex

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

shell
proto activate murex -> source

Nu

Generate the hook:

shell
(proto activate nu) | save ~/.config/nushell/proto-hook.nu

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

shell
use proto-hook.nu

Pwsh

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

shell
proto activate pwsh | Out-String | Invoke-Expression

Zsh

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

shell
eval "$(proto activate zsh)"