Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joehillen/ev-fish
Load environment variables from files and directories using fish shell, like envdir
https://github.com/joehillen/ev-fish
djb env environment environment-variables fish fish-plugin fish-plugins fish-shell fisherman oh-my-fish oh-my-fish-plugin
Last synced: 3 months ago
JSON representation
Load environment variables from files and directories using fish shell, like envdir
- Host: GitHub
- URL: https://github.com/joehillen/ev-fish
- Owner: joehillen
- License: mit
- Created: 2017-01-03T07:45:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-05-18T21:44:02.000Z (over 2 years ago)
- Last Synced: 2023-06-11T04:15:27.687Z (over 1 year ago)
- Topics: djb, env, environment, environment-variables, fish, fish-plugin, fish-plugins, fish-shell, fisherman, oh-my-fish, oh-my-fish-plugin
- Language: Shell
- Homepage:
- Size: 21.5 KB
- Stars: 19
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ev-fish
[envdir](https://cr.yp.to/daemontools/envdir.html) for fish shell
Load environment variables from files and directories.
# Usage
```
$ ev -h
Usage:
ev [-q] PATH ...
ev [-q] -u PATH ...Options:
-q No output
-u PATH Unset environment variables in PATH
-h --help Show this messageEVPATH=/home/joe/.config/env
EVPATH is the directory or list of directories where ev will search.
PATH can be a name of a file/directory in EVPATH or a path to a file/directory.
```By default, `EVPATH` is `$XDG_CONFIG_HOME/env`.
## Example
```
$ env | grep FOO
$ env | grep BAR
$ tree ~/.config/env/foo/
/home/joe/.config/env/foo/
├── FOO
└── BAR0 directories, 2 files
$ ev foo
FOO
BAR
$ env | grep FOO
FOO=foo123
$ env | grep BAR
BAR=bar
$ ev -u foo
FOO
BAR
$ env | grep FOO
$ env | grep BAR
```## Executables
If a file is executable, `ev` will run the file and store the result.
```
$ echo >IP "\
#!/bin/sh
curl -s ifconfig.co"
$ chmod +x IP
$ ./IP
8.8.8.8
$ env | grep IP
$ ev IP
IP
$ env | grep IP
IP=8.8.8.8
```## Recursive
`ev` will recursively add environment variables from subdirectories.
```
$ env | grep FOO
$ env | grep BAR
$ env | grep BAZ
$ tree envvars/
envvars/
└── foo
├── FOO
└── bar
├── BAR
└── baz
└── BAZ3 directories, 3 files
$ ev envvars
FOO
BAR
BAZ
$ env | grep FOO
FOO=foo
$ env | grep BAR
BAR=bar
$ env | grep BAZ
BAZ=baz
$ ev -u envvars
FOO
BAR
BAZ
$ env | grep FOO
$ env | grep BAR
$ env | grep BAZ
```# Installation
## [fisherman](https://github.com/fisherman/fisherman) (recommended)
```
fisher install joehillen/ev-fish
```## Using [fundle](https://github.com/tuvistavie/fundle)
Add the following to `~/.config/fish/config.fish` and run `fundle install`.
```
fundle plugin 'joehillen/ev-fish'
```## Manually
Run `make` or
```
cp functions/ev.fish ~/.config/fish/functions/
cp completions/ev.fish ~/.config/fish/completions/
```