Giter Club home page Giter Club logo

ev-fish's Introduction

ev-fish

envdir 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 message

EVPATH=/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
└── BAR

0 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
            └── BAZ

3 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 (recommended)

fisher install joehillen/ev-fish

Using 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/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.