The central truth is the central truth, and nothing that I care about is relative
A tool to help manage context/project specific shell-things like environment variables.
Core Goals:
``` bash
❯ mkdir -p foo/bar ❯ cd foo
❯ sauce No file at ~/.local/share/sauce/foo.toml ❯ sauce new
❯ sauce add var AWS_PROFILE=foo
❯ cd bar ❯ sauce add var foo=bar
❯ sauce Sourced ~/.local/share/sauce/foo/bar.toml
❯ env ... AWS_PROFILE=foo foo=bar ```
A thing which sauce
can load/unload is called a “target”.
Currently supported targets include:
Planned/Ideally supported targets include:
sauce
commandThe primary usecase is the sauce
command. Explicitly no arguments, you
load the environment with all sauce targets, cascaded from the uppermost
parent.
Given a directory structure
~/ projects/ foo/ subfoo/ bar/
You can run sauce
at any folder level/depth, say subfoo
. The values
saved for the folders: ~
, ~/projects
, ~/projects/foo
, and
~/projects/foo/subfoo
will all be loaded.
The more specific/deep folder’s values will take precedence over the values of more general/shallow folders.
All saucefiles are located in the $XDG_DATA_HOME/sauce
folder, after
which the folder structure mirrors that of the folders who’s values are
being tracked. Given the above example you might see:
~/.local/share/sauce/
foo/
subfoo.toml
foo.toml
bar.toml
projects.toml
sauce add <target-type> NAME=value
For example, sauce add var AWS_PROFILE=foo FOO=bar
.
This is convenient when you realize you want to sauce
a var or
whatever. There is also sauce edit
which will open your $EDITOR
so
you can bulk update whatever values you like.
sauce --as foo
Any key-value pair can be tagged with, you might call “namespaces”.
Consider an env var definition
toml
AWS_PROFILE = {default = "projectname-dev", uat = "projectname-uat", prod = "projectname-prod"}
Given a sauce
, you will get the “default” namespace
(i.e. AWS_PROFILE=projectname-dev) for this value, as well as all other
unnamespaced values.
Given sauce --as prod
, you will get the “prod” namespace
(i.e. AWS_PROFILE=projectname-prod) for this value, as well as all
other unnamespaced values.
sauce
maintains sole control over all tracked variables (because
it can/will unset
them if asked).sauce show
to a pager when beyond a full terminal heightsauce
on
cd
(i.e. direnv)