Switch environment context easily in the shell
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swytchit-0.2.1.tar.gz.
File metadata
- Download URL: swytchit-0.2.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.11 Linux/5.15.154+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2abd2a5d286eeb7107ec16db89f43c151f59ceff565a13d1aec2b758306c8bb7
|
|
| MD5 |
aba1a65f0c1c203c537e0d13f6d2224e
|
|
| BLAKE2b-256 |
81a01e6c7d669eb41c5295dd8db0e3d39a2329cbee5bbbd4204e8e3539be8d93
|
File details
Details for the file swytchit-0.2.1-py3-none-any.whl.
File metadata
- Download URL: swytchit-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.11 Linux/5.15.154+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e9608fee87915740d505c25abdeaa636478ee38b48e7aca27938406b204b6fa
|
|
| MD5 |
09aee117c7ba33ec0c5a91969891b410
|
|
| BLAKE2b-256 |
baf208549114bd5f5f4fee89118d9af6b10ec22d5d507a7678f09efa101d7e7c
|