From 41d48038e3b8b1cb6ccd6ed787af91207be7b68c Mon Sep 17 00:00:00 2001 From: Jeremie Jarosh Date: Sun, 16 Apr 2023 09:02:22 -0500 Subject: [PATCH] Various improvements to `--help` (#84) * Update `--help` Description Update the output of `--help` so it returns `itch-download` as the program name, and returns an accurate description of what the program does. * Make it clear `https://` needs to exist to download a specific game * Fix `pylint` errors Add missing docstring to the two CLI tools. Limit the length of strings. * Keep consistent style when listing platform types * Make `--human-folders` a proper on/off flag The `ArgumentParser.add_argument()` call has been updated to show up as an 'on/off' argument. * Conform to Code Style Guide * Add CLI tools to the linting workflow --- .github/workflows/lint.yml | 2 +- itchiodl/bundle_tool/__main__.py | 2 ++ itchiodl/downloader/__main__.py | 23 +++++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f953934..a7a5974 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,4 +22,4 @@ jobs: pip install poetry poetry install - name: Analysing the code with pylint - run: poetry run pylint --rcfile=.pylintrc itchiodl/ + run: poetry run pylint --rcfile=.pylintrc itchiodl/ itchiodl/downloader/ itchiodl/bundle_tool/ diff --git a/itchiodl/bundle_tool/__main__.py b/itchiodl/bundle_tool/__main__.py index 9d07c6d..e28f4e7 100644 --- a/itchiodl/bundle_tool/__main__.py +++ b/itchiodl/bundle_tool/__main__.py @@ -3,6 +3,8 @@ import itchiodl def main(): + """CLI tool to at all games in a bundle to your library.""" + user = input("Username: ") password = getpass("Password: ") diff --git a/itchiodl/downloader/__main__.py b/itchiodl/downloader/__main__.py index 164f9bf..22d6450 100644 --- a/itchiodl/downloader/__main__.py +++ b/itchiodl/downloader/__main__.py @@ -6,7 +6,11 @@ import itchiodl def main(): - parser = argparse.ArgumentParser(prog="python -m hstp", description="Build an ") + """CLI tool to download all games in your library.""" + + parser = argparse.ArgumentParser( + prog="itch-download", description="Download / archive your itch.io library." + ) parser.add_argument( "-k", "--api-key", help="Use API key instead of username/password" @@ -15,16 +19,19 @@ def main(): parser.add_argument( "-p", "--platform", - help="Platform to download for (default: all), will accept values like 'windows', 'linux', 'osx' and android", + help=( + "Platform to download for (default: all), will accept values like 'windows', 'linux', " + "'osx' and 'android'" + ), ) parser.add_argument( "--human-folders", - type=bool, - default=False, - const=True, - nargs="?", - help="Download Folders are named based on the full text version of the title instead of the trimmed URL title", + action="store_true", + help=( + "Download Folders are named based on the full text version of the title instead of " + "the trimmed URL title" + ), ) parser.add_argument( @@ -44,7 +51,7 @@ def main(): parser.add_argument( "--download-game", type=str, - help="Download a specific game, should be in the format publisher.itch.io/game", + help="Download a specific game, should be in the format 'https://publisher.itch.io/game'", ) args = parser.parse_args()