Context switching made easy for shell geeks
Project description
Swytchit
Context switching made easy for shell geeks
Usage
sw your/project/directory
- Performs a
cdoperation to the project - Starts a subshell
- Within the subshell, runs
sourceon.swytchitrc.shfiles in the project directory and any ancestor directories
Use the exit command when done with the project to exit the subshell and clear the environment.
Note that .swytchitrc.sh can support any source operation, including:
- Set environment variables
- Define aliases
- Define functions
Why?
- Easily switch virtual environments for scripting languages (Python, Ruby, etc)
- Easily populate project-specific environment variables and aliases
- Use with the
opCLI from 1Password to keep project-specific secrets in memory
Installation (MacOS)
brew install python3.11
python3.11 -m pip install pipx
pipx install swytchit
Also do a profile/rc song and dance something like this:
echo 'if [[ -n $SWYTCHITRC ]]; then source $SWYTCHITRC; fi' >> $ZDOTDIR/.zshrc
source $ZDOTDIR/.zshrc
(use e.g. .profile or .bashrc if not on zsh)
Rules
- Only works in TTY shell (no piping)
- Only works for a descendent of user's home directory
- Resolves symlinks first
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
swytchit-0.2.0.tar.gz
(2.8 kB
view hashes)