From e401e8aae1929c5646ee64f163970a39313be76c Mon Sep 17 00:00:00 2001 From: Kobu Date: Tue, 26 Nov 2024 14:07:04 +0100 Subject: [PATCH] feat: allow Path to be passed as parameter for path prompt --- questionary/prompts/path.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/questionary/prompts/path.py b/questionary/prompts/path.py index 507c304c..273fc2ef 100644 --- a/questionary/prompts/path.py +++ b/questionary/prompts/path.py @@ -1,4 +1,5 @@ import os +from pathlib import Path from typing import Any from typing import Callable from typing import Iterable @@ -115,7 +116,7 @@ def get_completions( def path( message: str, - default: str = "", + default: Path | str = "", qmark: str = DEFAULT_QUESTION_PREFIX, validate: Any = None, completer: Optional[Completer] = None, @@ -238,6 +239,6 @@ def next_segment(event: KeyPressEvent): key_bindings=bindings, **kwargs, ) - p.default_buffer.reset(Document(default)) + p.default_buffer.reset(Document(str(default))) return Question(p.app)