diff options
author | benadha <benawiadha@gmail.com> | 2022-02-20 21:16:34 +0700 |
---|---|---|
committer | benadha <benawiadha@gmail.com> | 2022-02-20 21:16:34 +0700 |
commit | 78cd38d1e31b619328404481ba0a6d80909fd33c (patch) | |
tree | 5c56a6db43f59196ed15ab45571ddc1367a2094f | |
parent | 2659232f52767abf9d82e9768462b68d03eaab2e (diff) | |
download | epy-78cd38d1e31b619328404481ba0a6d80909fd33c.tar.gz |
Breakdown parse_cli_args into its own method
-rwxr-xr-x | epy.py | 15 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | setup.py | 2 |
3 files changed, 9 insertions, 10 deletions
@@ -23,7 +23,7 @@ examples: """ -__version__ = "2022.2.14" +__version__ = "2022.2.20" __license__ = "GPL-3.0" __author__ = "Benawi Adha" __email__ = "benawiadha@gmail.com" @@ -3885,11 +3885,7 @@ def preread(stdscr, filepath: str): # Commandline {{{ -def parse_cli_args() -> Tuple[str, bool]: - """ - Parse CLI args and return tuple of filepath and boolean (dump ebook indicator). - And exiting the program depending on situation. - """ +def parse_cli_args() -> argparse.Namespace: prog = "epy" positional_arg_help_str = "[PATH | # | PATTERN | URL]" args_parser = argparse.ArgumentParser( @@ -3923,8 +3919,11 @@ def parse_cli_args() -> Tuple[str, bool]: metavar=positional_arg_help_str, help="ebook path, history number, pattern or URL", ) - args = args_parser.parse_args() + return args_parser.parse_args() + +def find_file() -> Tuple[str, bool]: + args = parse_cli_args() state = State() cleanup_library(state) @@ -3963,7 +3962,7 @@ def parse_cli_args() -> Tuple[str, bool]: def main(): - filepath, dump_only = parse_cli_args() + filepath, dump_only = find_file() if dump_only: sys.exit(dump_ebook_content(filepath)) diff --git a/pyproject.toml b/pyproject.toml index c04f92d..5add430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "epy-reader" -version = "2022.2.14" +version = "2022.2.20" description = "CLI Ebook Reader" authors = ["Benawi Adha <benawiadha@gmail.com>"] license = "GPL-3.0" @@ -6,7 +6,7 @@ with open("README.md", "r") as fh: setup( name="epy-reader", - version="2022.2.14", + version="2022.2.20", description="Terminal/CLI Ebook (epub, fb2, mobi, azw3) Reader", long_description=long_description, long_description_content_type="text/markdown", |