Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Allow to be run as a module #37

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alexandrehassan
Copy link

The changes allow advent-of-ocr to be called as a module. To achieve this the code has been moved out of __init__.py. This also adds a cli for the the tool that can be called after it has been installed.

>  python -m advent_of_code_ocr -h
usage: __main__.py [-h] [-f FILL_PIXEL] [-e EMPTY_PIXEL] [input_text]

positional arguments:
  input_text            Input text

options:
  -h, --help            show this help message and exit
  -f FILL_PIXEL, --fill-pixel FILL_PIXEL
                        Fill pixel character
  -e EMPTY_PIXEL, --empty-pixel EMPTY_PIXEL
                        Empty pixel character

Also included test to make sure argument parsing works as intended.

Additional cli tests:

echo -e '.##..###...##.\n#..#.#..#.#..#\n#..#.###..#...\n####.#..#.#...\n#..#.#..#.#..#\n#..#.###...##.' | python -m advent_of_code_ocr
> ABC
cat test.txt | python -m advent_of_code_ocr -f b -e a
> ABC

Closes #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to be run as a module
1 participant