Skip to main content

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

Icon by Flaticon

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)

Uploaded Source

Built Distribution

swytchit-0.2.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page