Skip to content

Commit

Permalink
[update] add cli mode
Browse files Browse the repository at this point in the history
  • Loading branch information
NatLee committed Sep 3, 2022
1 parent f36b966 commit 5cd7c3b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

This is a tool for converting format of HEIC image to PNG by using Python.

And it can be used with python simple CLI.
And it can be used with simple CLI mode.

I used the pypi package template to generate this repo, you can check it in the [references](#References).


## Installation

```bash
Expand All @@ -30,16 +29,16 @@ if __name__ == '__main__':

```

And, you can try simple CLI with this.
And, you can try CLI with this.

```bash
python -m heic2png --input_path test.heic --output_path test.png
heic2png --input_path test.heic --output_path test.png
```

Or, you want to keep original name, just use this.

```bash
python -m heic2png --input_path test.heic
heic2png --input_path test.heic
```

It'll generate `test.png` for you.
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@
extras_require={
'dev': ['check-manifest'],
# 'test': ['coverage'],
},
entry_points={
'console_scripts': [
'heic2png=heic2png.cli:main'
]
}
)
3 changes: 2 additions & 1 deletion src/heic2png/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__version__ = "0.9.5"
__version__ = "1.0.0"

from .heic2png import *
from .cli import main
7 changes: 4 additions & 3 deletions src/heic2png/__main__.py → src/heic2png/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from .heic2png import HEIC2PNG

def main(input_path:str, output_path:str=None):
def cli(input_path:str, output_path:str=None):
print(f'----- Input file path is `{input_path}`')
if output_path:
print(f'----- Set the output path is `{output_path}`')
Expand All @@ -21,5 +21,6 @@ def main(input_path:str, output_path:str=None):
print(f'----- Error with {e}')
print('----- Please report this issue!')

register_heif_opener()
Fire(main)
def main():
register_heif_opener()
Fire(cli)

0 comments on commit 5cd7c3b

Please sign in to comment.