Metadata-Version: 2.1
Name: os-exitcodes
Version: 1.0.0
Summary: A cross-operating-system compatible library for os.EX_* constants
Home-page: https://github.com/kkirsche/exitcodes
Keywords: exit codes,exit,sysexit
Author: Kevin Kirsche
Author-email: kev.kirsche@gmail.com
Requires-Python: >=3.7
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Project-URL: Repository, https://github.com/kkirsche/exitcodes
Description-Content-Type: text/markdown

# Exit Codes

This package is a cross-operating-system compatible version of the `os` library's EX\_\* constants.

If these constants are available, they will be re-exported directly from `os`, otherwise the integer version will be provided from this library.

This library also provides an enum version of the exit codes, if that is of value.

## Usage

### Constants

```python
from exitcodes import (
    EX_OK,
    EX_USAGE,
)
from random import choice

def is_valid_usage() -> bool:
    # check if the user is using this properly
    # for a working example, this is random
    return choice([True, False])

def main() -> None:
    invalid_usage = random
    if not is_valid_usage():
        raise SystemExit(EX_USAGE)
    raise SystemExit(EX_OK)

if __name__ == "__main__":
    main()
```

### Enumeration

```python
from exitcodes import ExitCode
from random import choice

def is_valid_usage() -> bool:
    # check if the user is using this properly
    # for a working example, this is random
    return choice([True, False])

def main() -> None:
    invalid_usage = random
    if not is_valid_usage():
        raise SystemExit(ExitCode.EX_USAGE)
    raise SystemExit(ExitCode.EX_OK)

if __name__ == "__main__":
    main()
```

