Skip to content

Commit

Permalink
feat: add INTERACTIVE CONFIGURATION action
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec4r committed Dec 6, 2023
1 parent d3aa7d9 commit a257753
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tutor/hooks/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def run_this_on_start(root, config, name):
#: :parameter str root: absolute path to the project root.
PROJECT_ROOT_READY: Action[str] = Action()

#: Triggered after all interactive questions have been asked.
#: You should use this action if you want to add new questions.
#:
#: :parameter dict config: project configuration.
INTERACTIVE_CONFIGURATION: Action[[Config]] = Action()


class Filters:
"""
Expand Down
4 changes: 3 additions & 1 deletion tutor/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click

from . import config as tutor_config
from . import env, exceptions, fmt
from . import env, exceptions, fmt, hooks
from .types import Config, get_typed


Expand Down Expand Up @@ -146,6 +146,8 @@ def ask_questions(config: Config, run_for_prod: Optional[bool] = None) -> None:
defaults,
)

hooks.Actions.INTERACTIVE_CONFIGURATION.do(config)


def ask(question: str, key: str, config: Config, defaults: Config) -> None:
default = get_typed(defaults, key, str)
Expand Down

0 comments on commit a257753

Please sign in to comment.