diff --git a/src/algokit/cli/__init__.py b/src/algokit/cli/__init__.py index fbee22a3..d7ff5a9f 100644 --- a/src/algokit/cli/__init__.py +++ b/src/algokit/cli/__init__.py @@ -15,7 +15,10 @@ @click.group( help="AlgoKit is your one-stop shop to develop applications on the Algorand blockchain.", - context_settings={"help_option_names": ["-h", "--help"]}, + context_settings={ + "help_option_names": ["-h", "--help"], + "max_content_width": 120, + }, ) @click.version_option(package_name=PACKAGE_NAME) @verbose_option diff --git a/src/algokit/cli/bootstrap.py b/src/algokit/cli/bootstrap.py index fa4931eb..1cb41a3a 100644 --- a/src/algokit/cli/bootstrap.py +++ b/src/algokit/cli/bootstrap.py @@ -4,7 +4,7 @@ import click from algokit.core.bootstrap import bootstrap_any_including_subdirs, bootstrap_env, bootstrap_npm, bootstrap_poetry -from algokit.core.questionary_extensions import _get_confirm_default_yes_prompt +from algokit.core.questionary_extensions import get_confirm_default_yes_prompt logger = logging.getLogger(__name__) @@ -19,7 +19,7 @@ def bootstrap_group() -> None: ) def bootstrap_all() -> None: cwd = Path.cwd() - bootstrap_any_including_subdirs(cwd, _get_confirm_default_yes_prompt) + bootstrap_any_including_subdirs(cwd, get_confirm_default_yes_prompt) logger.info(f"Finished bootstrapping {cwd}") @@ -30,7 +30,7 @@ def env() -> None: @bootstrap_group.command("poetry", short_help="Bootstrap Python Poetry and install in the current working directory.") def poetry() -> None: - bootstrap_poetry(Path.cwd(), _get_confirm_default_yes_prompt) + bootstrap_poetry(Path.cwd(), get_confirm_default_yes_prompt) @bootstrap_group.command("npm", short_help="Bootstrap Node.js project in the current working directory.") diff --git a/src/algokit/cli/init.py b/src/algokit/cli/init.py index e1126f96..f8f6f875 100644 --- a/src/algokit/cli/init.py +++ b/src/algokit/cli/init.py @@ -3,23 +3,17 @@ import shutil from dataclasses import dataclass from pathlib import Path - -from algokit.core.bootstrap import bootstrap_any_including_subdirs -from algokit.core.questionary_extensions import _get_confirm_default_yes_prompt -from algokit.core.sandbox import DEFAULT_ALGOD_PORT, DEFAULT_ALGOD_SERVER, DEFAULT_ALGOD_TOKEN, DEFAULT_INDEXER_PORT - -try: - from typing import Never # type: ignore[attr-defined] -except ImportError: - from typing import NoReturn as Never +from typing import NoReturn import click import prompt_toolkit.document import questionary from algokit.core import proc +from algokit.core.bootstrap import bootstrap_any_including_subdirs from algokit.core.log_handlers import EXTRA_EXCLUDE_FROM_CONSOLE -from algokit.core.questionary_extensions import ChainedValidator, NonEmptyValidator +from algokit.core.questionary_extensions import ChainedValidator, NonEmptyValidator, get_confirm_default_yes_prompt +from algokit.core.sandbox import DEFAULT_ALGOD_PORT, DEFAULT_ALGOD_SERVER, DEFAULT_ALGOD_TOKEN, DEFAULT_INDEXER_PORT logger = logging.getLogger(__name__) @@ -254,7 +248,7 @@ def _maybe_bootstrap(project_path: Path, *, run_bootstrap: bool | None, use_defa # note: we run bootstrap before git commit so that we can commit any lock files, # but if something goes wrong, we don't want to block try: - bootstrap_any_including_subdirs(project_path, _get_confirm_default_yes_prompt) + bootstrap_any_including_subdirs(project_path, get_confirm_default_yes_prompt) except Exception: logger.exception( "Bootstrap failed. Once any errors above are resolved, " @@ -268,7 +262,7 @@ def _maybe_git_init(project_path: Path, *, use_git: bool | None, commit_message: _git_init(project_path, commit_message=commit_message) -def _fail_and_bail() -> Never: +def _fail_and_bail() -> NoReturn: logger.info("🛑 Bailing out... 👋") raise click.exceptions.Exit(code=1) diff --git a/src/algokit/core/questionary_extensions.py b/src/algokit/core/questionary_extensions.py index ccec39dd..a24e9648 100644 --- a/src/algokit/core/questionary_extensions.py +++ b/src/algokit/core/questionary_extensions.py @@ -18,7 +18,7 @@ def validate(self, document: prompt_toolkit.document.Document) -> None: validator.validate(document) -def _get_confirm_default_yes_prompt(prompt: str) -> bool: +def get_confirm_default_yes_prompt(prompt: str) -> bool: return bool( questionary.confirm( prompt,