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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ Usage: /reg/g/pcds/engineering_tools/latest/scripts/check_host HOSTNAME<br/>
usage: source ctrlenv_setup.sh<br/>
<br/>
Set environment variables and add commands for using ctrlenv python tools.</br>
There are three subcommands that become available after sourcing:</br>
There are four subcommands that become available after sourcing:</br>
<ul>
<li>ctrlenv-pathmunge: adds a bundle, environment export bin, or application to your path.</li>
<li>ctrlenv-activate: activates a python environment.</li>
<li>ctrlenv-activate: activates a python environment in the current shell (useful for scripts).</li>
<li>ctrlenv-shell: activates a python environment in an exitable subshell (useful for interactive use).</li>
<li>ctrlenv-versions: shows which versions exist for an app or environment.</li>
</ul>
</br>
Expand Down Expand Up @@ -146,6 +147,7 @@ usage: source ctrlenv_setup.sh<br/>
<ul><li>Note: with no args, ctrlenv-activate targets the latest ctrlenv-base</li></ul>
<li>ctrlenv-activate ctrlenv-lucid</li>
<li>ctrlenv-activate ctrlenv-widgets/v0.2.0</li>
<li>ctrlenv-shell ctrlenv-widgets/v0.2.0</li>
<li>ctrlenv-version</li>
<ul><li>Note: with no args, ctrlenv-activate targets the ctrlenv-base</li></ul>
<li>ctrlenv-versions pytmc</li>
Expand Down
23 changes: 18 additions & 5 deletions scripts/ctrlenv_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# Source this script to set shared environment variables and gain access to three shell functions:
# 1. ctrlenv-pathmunge: adds the bin from a bundle, environment, or application to your path at a specific version
# 2. ctrlenv-activate: puts you into a released pixi environment (pixi shell-hook)
# 3. ctrlenv-versions: shows you which versions exist for an environment or application
# 2. ctrlenv-activate: activates a released pixi environment in the current shell (useful for scripts)
# 3. ctrlenv-shell: activates a released pixi environment in an exitable subshell (useful for interactive use)
# 4. ctrlenv-versions: shows you which versions exist for an environment or application
#
# Defaults are:
# - Always the latest release
Expand Down Expand Up @@ -39,13 +40,16 @@
# Activate the default environment
# ctrlenv-activate
# or
# ctrlenv-activate base
# ctrlenv-activate ctrlenv-base
#
# Activate the latest version of a specific environment
# ctrlenv-activate widgets
# ctrlenv-activate ctrlenv-widgets
#
# Activate a specific version of a specific environment
# ctrlenv-activate lucid/v0.1.2
# ctrlenv-activate ctrlenv-lucid/v0.1.2
#
# Any invocation of ctrlenv-activate also works with ctrlenv-shell
# ctrlenv-shell ctrlenv-widgets
#
# Show which versions exist for an environment or application
# ctrlenv-versions ctrlenv-widgets
Expand Down Expand Up @@ -211,6 +215,15 @@ ctrlenv-activate() {
return 1
}

# Enter an exitable shell with an environment.
# Useful for exploring the pixi environments interactively.
# Simply "exit" to exit the shell and deactivate the env.
# Do not use this in a shell script- it will interrupt your script with a prompt.
# This is functionally similar to the "pixi shell" command, but doesn't require pixi on the path.
ctrlenv-shell() {
$SHELL -ic "ctrlenv-activate $*; exec $SHELL -i"
}

# Show which versions exist
ctrlenv-versions() {
local target
Expand Down