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

Added: The ability to use conditional prompts #1645

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

nilsdebruin
Copy link

Added the ability to use conditional prompts based on an old issue (#913: #913).
I was looking for a solution, but I could not find it. I have created the first version for this including docs and tests.

Added the ability to use conditional prompts based on an old issue (cookiecutter#913)
@Ninjagod1251
Copy link

I love this thank you!

Copy link

@antazoey antazoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this feature, we are looking forward to using it in our on-going work.
Let us know if there is anything else we can do to help!

(@Ninjagod1251 too)

cookiecutter/prompt.py Outdated Show resolved Hide resolved
cookiecutter/prompt.py Outdated Show resolved Hide resolved
cookiecutter/prompt.py Outdated Show resolved Hide resolved
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
nilsdebruin and others added 5 commits March 22, 2022 13:37
Great addition!

Co-authored-by: Juliya Smith <yingthi@live.com>
Great!

Co-authored-by: Juliya Smith <yingthi@live.com>
Thanks!

Co-authored-by: Juliya Smith <yingthi@live.com>
Thanks!

Co-authored-by: Juliya Smith <yingthi@live.com>
@nilsdebruin
Copy link
Author

Thanks for this feature, we are looking forward to using it in our on-going work. Let us know if there is anything else we can do to help!

(@Ninjagod1251 too)

This is the first version, so I can imagine that this is 'rough around the edges'. We could have a quick chat and discuss possible next steps, happy to bring this further!

moskrc
moskrc previously approved these changes Mar 22, 2022
@Ninjagod1251
Copy link

Thanks for this feature, we are looking forward to using it in our on-going work. Let us know if there is anything else we can do to help!
(@Ninjagod1251 too)

This is the first version, so I can imagine that this is 'rough around the edges'. We could have a quick chat and discuss possible next steps, happy to bring this further!

Thanks for this feature, we are looking forward to using it in our on-going work. Let us know if there is anything else we can do to help!
(@Ninjagod1251 too)

This is the first version, so I can imagine that this is 'rough around the edges'. We could have a quick chat and discuss possible next steps, happy to bring this further!

@nilsdebruin Happy to connect! I am telegram with the same handle @Ninjagod1251

Copy link
Author

@nilsdebruin nilsdebruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes based on suggestions of @unparalleled-js

Copy link
Author

@nilsdebruin nilsdebruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if more changes are needed or that we should take a different route, happy to help!

@malcolmgreaves
Copy link

Thank you very much for implementing this functionality @nilsdebruin 👏 Is there a timeline for cutting a cookiecutter release with this feature? 🙏

docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
@@ -183,8 +183,11 @@ def prompt_for_config(context, no_input=False):
:param dict context: Source for field names and sample values.
:param no_input: Prompt the user at command line for manual configuration?
"""
conditional_keyword = "_if_use_"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since _ already has a meaning in cookiecutter identifiers, I would tend to use a different syntax here.
Ideas:

  • [if use VARNAME]
  • ? use VARNAME

(more ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As currently it is vatiable, I think we can leave it as it. For now. naming is not my best )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming matters. And it is confusing, if a prefix like _ has two different meanings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jensens, great suggestion! I can see what I can do about the naming issue. For example, as a third option, I could introduce ___ (3x _) as a prefix. I will try and see!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nilsdebruin any update on this? I'd like to see this land as I have a need for the conditional questions as well

@jensens
Copy link
Contributor

jensens commented Jun 2, 2022

Conflicts need to be resolved.

@jensens jensens added the enhancement This issue/PR relates to a feature request. label Jun 2, 2022
insspb
insspb previously approved these changes Jun 6, 2022
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
cookiecutter/prompt.py Outdated Show resolved Hide resolved
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
docs/advanced/conditional_variables.rst Outdated Show resolved Hide resolved
cookiecutter/prompt.py Outdated Show resolved Hide resolved
@insspb insspb changed the title Conditional prompts Added: the ability to use conditional prompts Jun 6, 2022
@insspb insspb changed the title Added: the ability to use conditional prompts Added: The ability to use conditional prompts Jun 6, 2022
jensens and others added 3 commits June 7, 2022 16:46
Co-authored-by: Andrey Shpak <insspb@users.noreply.github.com>
Co-authored-by: Andrey Shpak <insspb@users.noreply.github.com>
Co-authored-by: Andrey Shpak <insspb@users.noreply.github.com>
@xmnlab
Copy link

xmnlab commented Jan 5, 2023

hi everyone! just checking the current status of this issue and if there is any intention to move that forward or if we can help to move this forward.

thanks!!

@liortct
Copy link
Contributor

liortct commented Jan 11, 2023

Hi @xmnlab , @insspb , @jensens , @malcolmgreaves , @nilsdebruin , @Ninjagod1251 , @unparalleled-js , @moskrc

We started working on a new community fork of the Cookiecutter project, named Cookieninja.
The fork is found at: https://github.com/cookieninja-generator/cookieninja

We have re-opened and merged your PR in the Cookieninja project at: cookieninja-generator/cookieninja#26

We're trying to bring the life back to this amazing project.
We are committed to reviewing and merging each PR in up to 2 weeks from the day it's opened (if there are no issues with it).
We'd really like you to join the fork, star it and contribute to it!

Thank you :)

@pcko1
Copy link

pcko1 commented Jul 31, 2023

hi guys, I am in great need for this feature, is there any integration of it in any of the official releases? just from reading the release notes I would say now :(

@jensens
Copy link
Contributor

jensens commented Aug 10, 2023

It needs someone to work on it and fix the open issues.

@austinbenny
Copy link

Has this issue been resolved? if not, i would like to help attempt to resolve it.

@kusw3
Copy link

kusw3 commented Apr 17, 2024

@austinbenny, I assume you didn't progress it in the end?

@jensens, it's just the naming and the tests missing (a part from a master rebase)?

@jensens
Copy link
Contributor

jensens commented Apr 17, 2024

@jensens, it's just the naming and the tests missing (a part from a master rebase)?

It's been a while, as far as I can remember that is it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue/PR relates to a feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet