diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c003401..98d1050 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.3.10a +current_version = 0.4.0 commit = True tag = False parse = ^ diff --git a/README.md b/README.md index cc68cda..f517aff 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To report issues for the CLI, open an issue at https://github.com/FicHub/fichub- pip install -U fichub-cli ``` -## From Source (Might have bugs, for development use) +## From Source (Might have bugs, for testing only) ``` pip install git+https://github.com/FicHub/fichub-cli@main @@ -35,26 +35,31 @@ Usage: fichub_cli [OPTIONS] https://github.com/FicHub/fichub-cli/issues Options: - -u, --url TEXT The url of the fanfiction enclosed within quotes. - -i, --infile TEXT Give a filename to read URLs from. - -l, --list-url TEXT Enter a comma separated list of urls to download, - enclosed within quotes. + -u, --url TEXT The url of the fanfiction enclosed within quotes + -i, --infile TEXT Give a filename to read URLs from + -l, --list-url TEXT Enter a comma separated list of urls to download, enclosed within quotes -v, --verbose Verbose progressbar - -o, --out-dir TEXT Absolute path to the Output directory for files - (default: Current Directory). - -f, --format TEXT Download Format: epub (default), mobi, pdf or html. - --force Force overwrite of an existing file. - --get-urls TEXT Get all story urls found from a page. Currently - supports archiveofourown.org only. - -s, --supported-sites List of supported sites. - -d, --debug Show the log in the console for debugging. - --meta-json TEXT Fetch only the metadata for the fanfiction in json - format. - --log Save the logfile for debugging. - --version Display version & quit. - --help Show this message and exit. + -o, --out-dir TEXT Absolute path to the Output directory for files (default: Current Directory) + -f, --format TEXT Download Format: epub (default), mobi, pdf or html + --force Force overwrite of an existing file + --get-urls TEXT Get all story urls found from a page.Currently supports archiveofourown.org only + -s, --supported-sites List of supported sites + -d, --debug Show the log in the console for debugging + --meta-json TEXT Fetch only the metadata for the fanfiction in json format + --log Save the logfile for debugging + --version Display version & quit + --help Show this message and exit ``` +### Default Configuration + +- The fanfiction will be downloaded in epub format. To change it, use `-f` followed by the format. +- The fanfiction will be downloaded in the current directory. To change it, use `-o` followed by the path to the directory. +- Failed downloads will be saved in the `err.log` file in the current directory. +- `--meta-json` takes either URL or a file containing a list of URLs. + +Check `fichub_cli --help` for more info. + ## Example - To download using a URL @@ -87,14 +92,6 @@ fichub_cli --get-urls https://archiveofourown.org/users/flamethrower/ fichub_cli --meta-json "https://www.fanfiction.net/s/12933896/1/Things-you-cannot-leave-behind" ``` -### Default Configuration - -- The fanfiction will be downloaded in epub format. To change it, use `-f` followed by the format. -- The fanfiction will be downloaded in the current directory. To change it, use `-o` followed by the path to the directory. -- Failed downloads will be saved in the `err.log` file in the current directory. - -Check `fichub_cli --help` for more info. - # Links - [Official Discord Server](https://discord.gg/sByBAhX) diff --git a/fichub_cli/cli.py b/fichub_cli/cli.py index cfbd268..19d8bd0 100644 --- a/fichub_cli/cli.py +++ b/fichub_cli/cli.py @@ -13,21 +13,21 @@ # @logger.catch # for internal debugging @click.command(no_args_is_help=True) -@click.option('-u', '--url', help='The url of the fanfiction enclosed within quotes.') -@click.option('-i', '--infile', help='Give a filename to read URLs from.') -@click.option('-l', '--list-url', 'list_url', help='Enter a comma separated list of urls to download, enclosed within quotes.') +@click.option('-u', '--url', help='The url of the fanfiction enclosed within quotes') +@click.option('-i', '--infile', help='Give a filename to read URLs from') +@click.option('-l', '--list-url', 'list_url', help='Enter a comma separated list of urls to download, enclosed within quotes') @click.option('-v', '--verbose', default=False, help='Verbose progressbar', is_flag=True) -@click.option('-o', '--out-dir', 'out_dir', default="", help='Absolute path to the Output directory for files (default: Current Directory).') -@click.option('-f', '--format', '_format', default="epub", help='Download Format: epub (default), mobi, pdf or html.') -@click.option('--force', default=False, help=' Force overwrite of an existing file.', is_flag=True) -@click.option('--get-urls', 'get_urls', default=None, help='Get all story urls found from a page. Currently supports archiveofourown.org only.') -@click.option('-s', '--supported-sites', 'supported_sites', default=False, help='List of supported sites.', is_flag=True) -@click.option('-d', '--debug', default=False, help='Show the log in the console for debugging.', is_flag=True) -@click.option('--meta-json', 'meta_json', default=None, help='Fetch only the metadata for the fanfiction in json format.') -@click.option('--log', default=False, help='Save the logfile for debugging.', is_flag=True) -@click.option('-a', '--automated', default=False, help='For internal testing only.', is_flag=True, hidden=True) +@click.option('-o', '--out-dir', 'out_dir', default="", help='Absolute path to the Output directory for files (default: Current Directory)') +@click.option('-f', '--format', '_format', default="epub", help='Download Format: epub (default), mobi, pdf or html') +@click.option('--force', default=False, help=' Force overwrite of an existing file', is_flag=True) +@click.option('--get-urls', 'get_urls', default=None, help='Get all story urls found from a page. Currently supports archiveofourown.org only') +@click.option('-s', '--supported-sites', 'supported_sites', default=False, help='List of supported sites', is_flag=True) +@click.option('-d', '--debug', default=False, help='Show the log in the console for debugging', is_flag=True) +@click.option('--meta-json', 'meta_json', default=None, help='Fetch only the metadata for the fanfiction in json format') +@click.option('--log', default=False, help='Save the logfile for debugging', is_flag=True) +@click.option('-a', '--automated', default=False, help='For internal testing only', is_flag=True, hidden=True) @click.option('--pytest', default=False, help='To run pytest on the CLI for internal testing', is_flag=True, hidden=True) -@click.option('--version', default=False, help='Display version & quit.', is_flag=True) +@click.option('--version', default=False, help='Display version & quit', is_flag=True) def run_cli(infile: str, url: str, list_url: str, _format: str, get_urls: str, out_dir: str, debug: bool, version: bool, log: bool, supported_sites: bool, force: bool, automated: bool, @@ -76,7 +76,7 @@ def run_cli(infile: str, url: str, list_url: str, _format: str, get_urls: str, fic.get_metadata(meta_json) if version: - click.echo("Version: 0.3.10a") + click.echo("Version: 0.4.0") if supported_sites: click.echo(Fore.GREEN + """ diff --git a/fichub_cli/utils/fichub.py b/fichub_cli/utils/fichub.py index 9ac19fb..3e0fb55 100644 --- a/fichub_cli/utils/fichub.py +++ b/fichub_cli/utils/fichub.py @@ -6,7 +6,7 @@ import json headers = { - 'User-Agent': 'fichub_cli/0.3.10a', + 'User-Agent': 'fichub_cli/0.4.0', } diff --git a/setup.py b/setup.py index 2e3b1b7..6cedea8 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ description="A CLI for the fichub.net API", long_description=long_description, long_description_content_type="text/markdown", - version='0.3.10a', + version='0.4.0', license='MIT', url="https://github.com/FicHub/fichub-cli", packages=find_packages(include=['fichub_cli', 'fichub_cli.*']), diff --git a/tests/test_cli.py b/tests/test_cli.py index d1bdfaf..430e1a5 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -47,4 +47,4 @@ def test_cli_version(): assert not result.exception assert result.exit_code == 0 - assert result.output.strip() == 'Version: 0.3.10a' + assert result.output.strip() == 'Version: 0.4.0'