Skip to content

Commit

Permalink
feat: add fzf to select hook
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Jul 20, 2022
1 parent e2a10cf commit 3a295c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tackle/providers/prompts/hooks/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class InquirerCheckboxHook(BaseHook):
index: bool = Field(
False, description="Boolean to return the index instead of the answer"
)
fuzzy: bool = Field(
False,
description="Allow fuzzy search like fzf - [docs](https://inquirerpy.readthedocs.io/en/latest/pages/prompts/fuzzy.html)",
)

args: list = ['message']
_docs_order: int = 2
Expand Down Expand Up @@ -131,7 +135,7 @@ def _run_prompt(self):
choices = self.choices

question = {
'type': 'checkbox',
'type': 'checkbox' if not self.fuzzy else 'fuzzy',
'name': 'tmp',
'message': self.message,
'choices': choices,
Expand Down
3 changes: 3 additions & 0 deletions tackle/providers/prompts/hooks/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def exec(self) -> str:
if self.message is None:
self.message = get_readable_key_path(self.key_path) + ' >>>'

if self.default is not None and not isinstance(self.default, str):
self.default = str(self.default)

if not self.no_input:
question = {
'type': 'input',
Expand Down

0 comments on commit 3a295c8

Please sign in to comment.