Metadata-Version: 2.1
Name: delta-env
Version: 1.0.0
Summary: A simple tool to analyze how a shell script modifies environment variables
Author-email: Cetin Alanyalioglu <cetinalanyalioglu@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Cetin Alanyalioglu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/cetinalanyalioglu/delta-env
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.0.0
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE.md

# delta-env
This is a very simple tool to report environment variable changes when a shell script is sourced. Useful while creating [modulefiles](https://lmod.readthedocs.io/en/latest/) for various applications that are shipped with scripts that set up the user environment.

This package does not depend on any additional python packages, only requirement is ```python > 3.0.0```. **Does not work on Windows operating system.**

What the tool does is simply sourcing the given script and reporting differences from the default environment variables in an organized way.

> **WARNING** This tool WILL carry out the actions in the given script to be analyzed. If it is of harmful nature, damage will be done. Do NOT run this tool as ```root```. Do NOT run this tool with scripts that are of unknown/unstrusted sources!

## Installation
Clone this repository, ```cd``` into the cloned directory, and install via ```pip```,

```
pip install .
```

## Usage
This tool is meant to be used from the command line via the executable ```delta-env```,

```
delta-env <path-to-script>
```

The output will be displayed in the terminal screen, reporting added, removed and modified environment variables seperately.

By default, modifications are reported with respect to the **default user environment** that is present after creation of a login shell. This behaviour can be changed by using the ```--from-current``` argument to use the current environment (where ```delta-env``` is executed) as basis. Note that environment variables that were created without the ```export``` command will not be passed to subprocesses, and hence will not be visible to ```delta-env```.

If no shell executable is supplied via ```--shell <path-to-shell>``` argument, it is obtained from the value of environment variable ```SHELL```.

