xenv 0.2.0

A cross-shell env sourcing command
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 40.38 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 113.16 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ladysamantha/xenv
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ladysamantha

xenv

GitHub Actions

A cross-shell env sourcing command.

I use fish a lot, but I also like to do

source .env

when I want to source specific environment variables for a shell session.

As far as I know fish doesn't have this capability (natively), and I figured I would write something that could work across different shells, just in case I switch to zsh or something else.

installation and usage

To install it, you need cargo installed. Once installed run the following command:

cargo install xenv
# this will look for a .xenv file in your current working directory
xenv echo hello this is my command

# you can also override this with the XENV_PATH environment variable

# if using fish < 3.1, you'll need to do 'env XENV_PATH
XENV_PATH=xenv.env xenv env | rg foo

.xenv file format

It'll follow the format for any .env file, but for reference, here's the docker-compose .env rules

# here is an example
FOO=bar

# it's case insensitive
foo=bar

# empty keys will be skipped
=qux

# empty values are allowed
BANG=