Skip to content

Commit

Permalink
feat: increase max content width to 120 for easier reading in wider t…
Browse files Browse the repository at this point in the history
…erminals

note that text will still be wrapped to the terminal width if that is less than 120

style: remove underscore from public method

style: fix imports in init.py

style: remove unnecessary import-rename of NoReturn
  • Loading branch information
achidlow committed Mar 21, 2023
1 parent f1c1d69 commit cadc615
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/algokit/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/algokit/cli/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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}")


Expand All @@ -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.")
Expand Down
18 changes: 6 additions & 12 deletions src/algokit/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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, "
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/algokit/core/questionary_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

1 comment on commit cadc615

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit
   __init__.py15753%6–13, 17–24, 32–34
   __main__.py220%1–3
src/algokit/cli
   completions.py105298%78, 93
   doctor.py48394%138–140
   goal.py30197%37
   init.py1681591%252–253, 275, 278–280, 291, 329, 378, 387–389, 392–397, 412
   localnet.py91397%157, 178–179
src/algokit/core
   bootstrap.py1341688%109, 132, 197, 200, 206–220
   conf.py30487%13, 17, 25, 27
   doctor.py65789%67–69, 92–94, 134
   log_handlers.py68790%50–51, 63, 112–116, 125
   proc.py45198%98
   sandbox.py1171587%84–91, 102, 167, 183, 198–200, 216
   version_prompt.py73889%27–28, 40, 59–62, 80, 109
TOTAL11159192% 

Tests Skipped Failures Errors Time
185 0 💤 0 ❌ 0 🔥 14.834s ⏱️

Please sign in to comment.