Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow Path object to be passed as default #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Kobu
Copy link

@Kobu Kobu commented Nov 26, 2024

What is the problem that this PR addresses?

More often than not, when we prompt the user for a path, we later construct a builtin Path object from the received string. Following this notion, it is only logical that such object can also be passed as default parameter to the questionary.path() function.

How did you solve it?

We expand the type of default parameter to Path | str while also keeping its default value to be an empty string. Then we change the reference to this parameter on line 242 and we cast it to string using str(default). If default is of type Path, then we recieve the corresponding path as a string, if its type is str then nothing happens.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant