Context switching made easy for shell geeks
Project description
Swytchit
Context switching made easy for shell geeks
Usage
sw your/project/directory
- Performs a
cd
operation to the project - Starts a subshell
- Within the subshell, runs
source
on.swytchitrc.sh
files 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
op
CLI 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 details)
Built Distribution
File details
Details for the file swytchit-0.2.0.tar.gz
.
File metadata
- Download URL: swytchit-0.2.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bdfb6f2b4e914358330bb2c6368e110d6f37c4cabf87036e8d8ce91b4c4fb1b |
|
MD5 | eca3a93528a3952169b2bcc89b8a504f |
|
BLAKE2b-256 | 5bc27413a645ba0af56a43966df6a405a08295ff492bad2c3e0cece910958250 |
File details
Details for the file swytchit-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: swytchit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a5ffb5106e74171a5354b480bd3aabeef33831383a9d8513458437210f1ee71 |
|
MD5 | 77b58db84ee2d8c6dfb4b7ff63b11349 |
|
BLAKE2b-256 | 4242e26eaf8bc8810dcb9068115b37a66b578296bdd8289b242db6ec6cc4a0cc |