Switch environment according to current working directory. Heavily inspired by the amazing direnv, but not limited to environment variables and only targeting fish shell.
Configure any combination of the following in a simple YAML file:
- ssh identities
- paths (to append to
$fish_user_paths, which then becomes a universal variable) - global (= universal) variables
- git user details (name, email address)
Whenever you visit a directory containing a .cuttlefish.yaml file, its configuration is applied to your environment.
Note: Only subdirectories of the user's home directory are scanned.
Note: The script installs itself in your ~/.config/fish/config.fish: before doing so, though, it will copy the original file to ~/.config/fish/config.fish_bck so that it can be restored for any reason (see install target in Makefile for more details).
Grab the binaries from the releases page, uncompress them and run e.g.
cd cuttlefish-darwin64
make installThe installation requires Go 1.25+.
git clone https://github.com/fedragon/cuttlefish
cd cuttlefish
makeCreate a .cuttlefish.yaml in every directory where you want to load a different environment and ensure it is only writable by the current user (chmod 644 .cuttlefish.yaml).
The file should look like this:
git_config:
name: John Doe
email: [email protected]
ssh_identities:
- ~/.ssh/id_rsa1
- ~/.ssh/id_rsa2
# - ...
user_paths:
- ~/Documents
- ~/Desktop
# - ...
global_variables:
FOO: bar
# x: y
# ... : ...Any combination of the above fields is possible and they're all optional. A complete example is available in examples/cuttlefish.yaml.
cd cuttlefish
make uninstallmake buildNote: This requires a running Docker daemon.
make testmake releaseCuttlefish logo made by Freepik.
