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.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dot_to_osscript-0.3.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.tar.gz
Algorithm Hash digest
SHA256 004a7240c7e586ff0d900acd24f18a7cf5633f49dda2326f811ac594bf156f8b
MD5 4fe980b82e3aa311a070dceac90d4d52
BLAKE2b-256 fd6a0055ff160221cb23b2a5e3d1fd9cf07895b1baffc2beec48f091ee4de3b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dot_to_osscript-0.3-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-py3-none-any.whl
Algorithm Hash digest
SHA256 996b4689f13305dcb4747f9a9ba8193f2203fd02cdc28d2de7b2e4a8521bab0f
MD5 aecaf575e83b3da44c4415732b4b5744
BLAKE2b-256 1b4b400bcc00777bf3dd3de7f558a27ef598b7308f70647f4d480ba8eb51874c

See more details on using hashes here.

Supported by

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