Skip to main content

Generate sh and ps1 scripts from .env files to apply for the process

Project description

dot_to_osscript

The most universal way to work with .env files!

Generate script based on .env and files, so it could be imported to the current process

Install

pip install dot-to-osscript

Usage

Usage: python -m dot_to_osscript [OPTIONS]

Options:

`-p`, `--powershell`     Generate .env.ps1
`-s`, `--shell`          Generate .env.sh
`-e`, `--env-file TEXT`  Input file  [default: ./.env]
`-a`, `--path-append`    Appent to existing Path variable

Example

We have some directory (./) with .env file:

MSYSTEM=mingw32
TEST_var="TEST VAL"
PATH=/my_app/bin

We execute: python -m dot_to_osscript -psa and get :

.env.ps1

Set-Variable -Name 'MSYSTEM' -Value 'mingw32'
Set-Variable -Name 'TEST_var' -Value '"TEST VAL"'
Set-Variable -Name 'Path' -Value '$env:Path;/my_app/bin'

.env.sh

MSYSTEM='mingw32'
TEST_var='"TEST VAL"'
PATH='$PATH:/my_app/bin'

We could import files to the current command line process:

For PowerShell: . .env.ps1

For bash: source .env.sh

Tip

The best idea is to use oneliners.

Powershell:

python -m dot_to_osscript -pa; . .env.ps1; Remove-Item .env.ps1

bash:

python -m dot_to_osscript -pa; source .env.sh; rm ./.env.sh

It generate ps1/sh file, import it and remove the file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dot-to-osscript, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size dot_to_osscript-0.3.1-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dot_to_osscript-0.3.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page