Skip to content
This repository was archived by the owner on Oct 14, 2022. It is now read-only.

Run foreign bash scripts and capture exported environment variables

License

Notifications You must be signed in to change notification settings

mnewt/plugin-foreign-env

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foreign Environment

A foreign environment interface for Fish shell

MIT License Fish Shell Version

This is a fork of the original

Some changes have been made since the original was last updated. Please see the Change log

Highlights of the changes compared to the original:

  • Works with interactive commands
  • Support for aliases
  • Support un-setting variables
  • Added -v option (verbose) in addition to -d
  • Added --test option

Foreign environment wraps application execution in a way that environment variables and aliases that are exported or modified get imported back into fish. This makes possible running popular bash scripts, like the excellent nvm.

Install

Using Oh My Fish:

omf install mnewt/foreign-env

Using Fisherman:

fisher mnewt/foreign-env

No framework

If you dislike shell frameworks, you can still use Foreign Environment in Fish! Clone this repo somewhere and append to your ~/.config/fish/config.fish:

set fish_function_path $fish_function_path <insert path to foreign-env repo>/functions

Usage examples

You can use bash syntax to export variables:

fenv export PYTHON=python2

This will have the same effect as typing:

set -g -x PYTHON python2

You can also call multiple commands, separated by semicolon:

fenv source ~/.nvm/nvm.sh \; nvm --help

When commands aren't double quoted, you need to escape semicolon with slash \; to prevent fish from interpreting it. Or just quote the whole command:

fenv "source ~/.nvm/nvm.sh; nvm --help"

Command line options

usage: fenv [-htv] <bash command>
   -h, --help:    Help    - Print this help message
   -t, --test:    Test    - Print the variables and aliases that would be
                            created, but make no changes
   -v, --verbose: Verbose - Print the variables and aliases that are created
                            (-d also works)

To Do

There are some more features I would like to add in the TODO file.

License

MIT © Original author Derek Willian Stavis

About

Run foreign bash scripts and capture exported environment variables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%