Git Product home page Git Product logo

posh-direnv's Introduction

posh-direnv

Inspired by direnv

https://github.com/direnv/direnv

posh-direnv is an environment switcher for the PowerShell. It executes ".psdirenv" in the current directory. You can easily set unique environment variables for each directory.

How to install

You can install from PowerShell Gallery. posh-direnv

$ Install-Module -Name posh-direnv

Usage

$ mkdir work
$ cd work
$ Edit-DirEnvRc

Since notepad starts up, edit .psdirenv. When you exit the editor .psdirenv is authorised and applied if the file was modified.

$ cat .\.psenvrc
Write-Host "Hello posh-direnv"
$Host.UI.RawUI.WindowTitle="posh-direnv"

Activate the new powershell and check its operation. If you move to a directory with .psdirenv, it will be displayed as below and the console title will be changed.

$ cd work
psenvdir: loading work/.psenvrc
Hello posh-direnv
psenvdir: export

Once you exit the directory tree and move again the environment changes will be reversed and reapplied if you reenter the directory.

If you edit the .psenvrc file yourself or move it between directories you must authorise it before it will be applied.

$ cd work
psenvdir: work/.psenvrc not in allow list
$ Approve-DirEnvRc
psenvdir: loading work/.psenvrc
Hello posh-direnv
psenvdir: export

You can unauthorise a .psenvrc file by calling Deny-DirEnvRc and cleanup the authorised list in the event directories are deleted before being denied by calling Repair-DirEnvAuth.

posh-direnv's People

Contributors

darkshadow75 avatar de1acr0ix avatar netnode avatar takekazuomi avatar

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.