diff --git a/README.md b/README.md index f1bfac7..1f79fe2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ -# pillow-mbm-plugin -Pillow plugin for KSP MBM texture files +# Pillow-mbm +Pillow-mbm is a plugin for [pillow](https://pillow.readthedocs.io/en/stable/) +that adds support for KSP's proprietary MBM texture format. + +## Installation + +To install from Pypi, run: + +```shell +python -m pip install pillow-mbm +``` + +## Usage + +To decode MBM files, use the `convert-mbm` command, along with a glob or a +list of files to decode. By default, it will convert to png in place. + +``` +Usage: convert-mbm [OPTIONS] [FILENAMES]... + + Decode Kerbal Space Program MBM files + +Options: + -f, --flip / -F, --no-flip Vertically flip image after converting. + -r, --remove Remove input images after converting. + -s, --suffix TEXT Suffix to append to output file(s). Ignored if + output is a single file. + + -x, --extension TEXT Extension to use for output. Ignored if output + is a single file. Output filetype is deduced + from this [default: .png] + + -o, --output PATH Output file or directory. If outputting to a + file, input filenames must be only a single + item. By default, files are decoded in place. + + --version Show the version and exit. + --help Show this message and exit. +``` \ No newline at end of file diff --git a/pillow_mbm/__main__.py b/pillow_mbm/__main__.py index 2fbc747..42b64b7 100644 --- a/pillow_mbm/__main__.py +++ b/pillow_mbm/__main__.py @@ -3,6 +3,7 @@ import os import click from typing import List from PIL import Image +import pillow_mbm def get_decoded_extensions(feature: str = 'open') -> List[str]: @@ -66,6 +67,7 @@ def path_pairs(inputs, output, suffix, extension): type=click.Path(writable=True), default=None, help="Output file or directory. If outputting to a file, input filenames must be only a single item. By default, files are decoded in place.") @click.argument('filenames', nargs=-1, type=click.Path(exists=True, readable=True, dir_okay=False)) +@click.version_option(version=pillow_mbm.__version__) def decode(flip, remove, suffix, extension, output, filenames): """Decode Kerbal Space Program MBM files""" diff --git a/setup.py b/setup.py index f4c50ac..2c6122f 100644 --- a/setup.py +++ b/setup.py @@ -16,10 +16,9 @@ setup( long_description=readme, long_description_content_type='text/markdown', python_requires=">=3.7", - install_requires=['Pillow'], - extras_require={'CLI': ['click']}, + install_requires=['Pillow', 'click'], entry_points={ - 'console_scripts': ['convert-mbm = pillow_mbm.__main__:decode [CLI]'] + 'console_scripts': ['convert-mbm = pillow_mbm.__main__:decode'] }, package_dir={'': '.'}, packages=['pillow_mbm'],