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.

Source Distribution

dot_to_osscript-0.3.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

dot_to_osscript-0.3.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file dot_to_osscript-0.3.1.tar.gz.

File metadata

  • Download URL: dot_to_osscript-0.3.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for dot_to_osscript-0.3.1.tar.gz
Algorithm Hash digest
SHA256 95e17a85fc61a74038fd4634d3f28d4d89e26788170a4735d7f8f1022ec9cd37
MD5 7d9aadab3972b925fbd0205ec6b9eaa7
BLAKE2b-256 dd5574a7692e8d5e77236cfb1ded6ae2db2f2ef55ae70d77aa5059ebb6d74aae

See more details on using hashes here.

File details

Details for the file dot_to_osscript-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: dot_to_osscript-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for dot_to_osscript-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ab4bc9bf231adc34929f9cc24f0ecdebad0d39d974722f575349544bde3624
MD5 f98f0dba80a303dba89a29451fce7b87
BLAKE2b-256 022632dec7de1ced47c1fdbc1e52082c172b391cc8cdc0daf122828b99fa28fd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page