Giter VIP home page Giter VIP logo

atmosphere's Introduction

Overview

Atmosphere is a Powershell Core module for pushing, popping, getting, setting, updating, and importing environment variables. It currently works on Windows, macOS, and Linux. It's released under the MIT License.

Build and Tests Package codecov

Installation

Install-Module

Atmosphere is currently published on the Powershell Gallery:

Install-Module -Name Atmosphere

If you are not in an administrator powershell instance, and lack the ability to launch one, simply install into CurrentUser scope.

Install-Module -Name Atmosphere -Scope CurrentUser

Implicit module importing should handle the rest.

Building from source

Atmosphere is written directly in C# for performance, and as an example for others who want to know how to write so-called "native" Powershell Modules. To build, simply use the dotnet command.

dotnet build --nologo --configuration Release

Usage

Atmosphere provides several cmdlets for use

Basic Usage

The most basic commands are setting and getting environment variables

Set-EnvironmentVariable -Name <String> -Value <String> -Scope {Process|Machine|User}

Sets the environment variable -Name to the -Value given. Use Set-EnvironmentPathVariable if setting multiple filepaths is desired.

If -Scope is not Process and the current operating system is not Windows, it will be set to Process. The default value for -Scope is Process, and rarely needs to be specified.

Get-EnvironmentVariable -Name <Name> -Scope {Process|Machine|User}

Returns the value of the Environment Variable -Name. If no value is set, or the variable does not exist, an empty string is returned.

See Set-EnvironmentVariable for information on the -Scope parameter.

Getting Lists of Paths

There are some environment variables where a path separator is provided. Having to constantly split these apart can be time consuming and as a result Atmosphere provides both a generalized command to receive any environment variable as a list of paths or specific well known environment variables as a list of paths.

Get-EnvironmentPath -Name PSModulePath

The following command (Get-PSModulePath) is functionally the same as the example found above.

Get-PSModulePath

Pushing and Popping

Atmosphere has an internal "stack" of environment variable states. This allows users to push and pop their current state to permit temporary modifications to and rollbacks of the set of environment variables in a given powershell instance.

Push-Environment
Set-EnvironmentVariable -Name DOCKER_BUILDKIT -Value 1
<# Put Docker Related Commands Here #>
Pop-Environment

Updating and Importing

Atmosphere provides a small command to permit appending (or prepending) data to an environment variable. Additionally, we can also "import" environments, such as dotenv (.env), JSON, and PSD1 (powershell data) files.

Please note that at the moment we only support importing from a JSON file, where the expected layout is { "key": "value" }.

atmosphere's People

Contributors

bruxisma avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.