Skip to content

Commit

Permalink
run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Cube707 committed Jan 8, 2024
1 parent 40b6451 commit 11d575f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ If any of the list values is a pair, it should be a tuple like: `(label, value)`
As before, the `answers` is a `dict` containing the previous answers.

### hints

**Optional** for `Checkbox` and `List` questions; the rest of them do not have hints.

The hint for the selected choice will be shown above the first choice.
Expand Down
8 changes: 4 additions & 4 deletions examples/checkbox_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@


choices_hints = {
("Computers", 'c'): "The really Geeky stuff",
("Books", 'b'): "Its just so cosy",
("Science", 's'): "I want to know it all",
("Nature", 'n'): "Always outdoors",
("Computers", "c"): "The really Geeky stuff",
("Books", "b"): "Its just so cosy",
("Science", "s"): "I want to know it all",
("Nature", "n"): "Always outdoors",
}

questions = [
Expand Down
12 changes: 5 additions & 7 deletions examples/list_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import inquirer # noqa

choices_hints = {
"Jumbo": "The biggest one we have",
"Large": "If you need the extra kick",
"Standard": "For your every day use",
choices_hints = {
"Jumbo": "The biggest one we have",
"Large": "If you need the extra kick",
"Standard": "For your every day use",
}

questions = [
inquirer.List(
"size", message="What size do you need?", choices=choices_hints.keys(), hints=choices_hints
),
inquirer.List("size", message="What size do you need?", choices=choices_hints.keys(), hints=choices_hints),
]

answers = inquirer.prompt(questions)
Expand Down
8 changes: 4 additions & 4 deletions src/inquirer/render/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ def _print_header(self, render):
)

def _print_hint(self, render):
msg_template = (
"{t.move_up}{t.clear_eol}{color}{msg}"
)
msg_template = "{t.move_up}{t.clear_eol}{color}{msg}"
hint = render.get_hint()
color = self._theme.Question.mark_color
if hint:
self.print_str(f"\n{msg_template}", msg=hint, color=color, lf=not render.title_inline, tq=self._theme.Question)
self.print_str(
f"\n{msg_template}", msg=hint, color=color, lf=not render.title_inline, tq=self._theme.Question
)

def _process_input(self, render):
try:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/console_render/test_checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def test_first_hint_is_shown(self):
"bar": "Bar",
"bazz": "Bazz",
}

question = questions.Checkbox(variable, message, choices=choices.keys(), hints=choices)

sut = ConsoleRender(event_generator=stdin)
Expand All @@ -421,7 +421,7 @@ def test_second_hint_is_shown(self):
"bar": "Bar",
"bazz": "Bazz",
}

question = questions.Checkbox(variable, message, choices=choices.keys(), hints=choices)

sut = ConsoleRender(event_generator=stdin)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/console_render/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_first_hint_is_shown(self):
"bar": "Bar",
"bazz": "Bazz",
}

question = questions.List(variable, message, choices=choices.keys(), hints=choices)

sut = ConsoleRender(event_generator=stdin)
Expand All @@ -158,7 +158,7 @@ def test_second_hint_is_shown(self):
"bar": "Bar",
"bazz": "Bazz",
}

question = questions.List(variable, message, choices=choices.keys(), hints=choices)

sut = ConsoleRender(event_generator=stdin)
Expand Down

0 comments on commit 11d575f

Please sign in to comment.