mirror of
https://github.com/drewcassidy/Pillow-mbm.git
synced 2024-09-01 14:44:04 +00:00
Add --verbose option
This commit is contained in:
parent
1b39b02999
commit
bb03fd03a3
2
.github/workflows/python-publish.yml
vendored
2
.github/workflows/python-publish.yml
vendored
@ -5,7 +5,7 @@ name: Upload Python Package
|
||||
on:
|
||||
release:
|
||||
# Only use the types keyword to narrow down the activity types that will trigger your workflow.
|
||||
types: [published, created, edited]
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
|
||||
## 0.1.3 - 2021-04-13
|
||||
### Added
|
||||
- new `--verbose` command line option that prints the input and output path for each file
|
||||
|
||||
## 0.1.2 - 2021-04-12
|
||||
### Added
|
||||
- First stable release
|
@ -66,14 +66,18 @@ def path_pairs(inputs, output, suffix, extension):
|
||||
@click.option('-o', '--output',
|
||||
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.option('-v', '--verbose', is_flag=True, help="print more information")
|
||||
@click.argument('filenames', nargs=-1, type=click.Path(exists=True, readable=True, dir_okay=False))
|
||||
@click.version_option(version=pillow_mbm.__version__)
|
||||
def convert_mbm(flip, remove, suffix, extension, output, filenames):
|
||||
def convert_mbm(flip, remove, suffix, extension, output, verbose, filenames):
|
||||
"""Decode Kerbal Space Program MBM files"""
|
||||
|
||||
pairs = path_pairs(filenames, output, suffix, extension)
|
||||
|
||||
with click.progressbar(pairs, show_eta=False, show_pos=True, item_show_func=lambda x: str(x[0]) if x else '') as bar:
|
||||
with click.progressbar(pairs, show_eta=False, show_pos=True, item_show_func=lambda x: f'{x[0]}->{x[1]}' if x else '') as bar:
|
||||
if verbose:
|
||||
bar.is_hidden = True
|
||||
|
||||
for inpath, outpath in bar:
|
||||
image = Image.open(inpath)
|
||||
|
||||
@ -85,6 +89,12 @@ def convert_mbm(flip, remove, suffix, extension, output, filenames):
|
||||
if remove:
|
||||
os.remove(inpath)
|
||||
|
||||
if verbose:
|
||||
print(f'Converting: {inpath} -> {outpath}')
|
||||
|
||||
if verbose:
|
||||
print(f'Done: converted {len(pairs)} files')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
convert_mbm()
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '0.1.2'
|
||||
__version__ = '0.1.3'
|
||||
|
Loading…
Reference in New Issue
Block a user