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

Add multiple choice prompt #218

Closed
baurmatt opened this issue Jun 8, 2020 · 8 comments · Fixed by #1386
Closed

Add multiple choice prompt #218

baurmatt opened this issue Jun 8, 2020 · 8 comments · Fixed by #1386
Labels
enhancement good first issue Easy things for newbies
Milestone

Comments

@baurmatt
Copy link

baurmatt commented Jun 8, 2020

#93/#107 implemented support for single choice questions. I'd love to see an option to use multiple choice prompts. Thinking about something like this:

ci_type:
  type: str
  help: Which CI configuration do you need?
  multiplechoice:
    - travis
    - circleci
    - gitlabci
    - jenkins
Which CI configuration do you need?
ci_type? Format: str
🎤
( ) travis
( ) circleci
( ) gitlabci
( ) jenkins
@yajo
Copy link
Member

yajo commented Jun 9, 2020

A new prompt toolkit is planned in #210 that might allow that. With our current toolkit, it's not possible.

However, that doesn't mean we will implement what you ask. Isn't using 4 boolean questions just good enough? 🤔 :

# copier.yml
use_travis: yes
use_circleci: yes
use_gitlabci: yes
use_jenkins: yes

Your templating is going to be a lot easier too this way.

@baurmatt
Copy link
Author

baurmatt commented Jun 9, 2020

Looking forward to #210 being implemented! :) Yes, boolean is definitely an alternative here, though I would look nicer with an multiple choice prompt.

@pawamoy
Copy link
Contributor

pawamoy commented Jun 9, 2020

I was going to say that I agree with @yajo that 4 booleans parameters would be easier to use in the templates, but actually typing it shows that it would still be simple with a "multiple choice" value.

With booleans:

{% if use_travis %}...

With multiple choices:

{% if "travis" in ci_type %}...

We would then have to cast the multiple choice values as lists of the specified type of course.

@yajo
Copy link
Member

yajo commented Jun 10, 2020

Yeah however, what does this exactly add? I mean, supporting this use case doesn't seem so easy, and at the end of the day you just get the same features but printed in a different fashion. Is it worth it? We don't have a huge team here... 🤔

I guess when we handle #210 we'll have to see how easy this is. And if it isn't much easy, I guess this will be discarded.

@baurmatt
Copy link
Author

@yajo This is definitely a nice to have but would make a nicer "UI" for the end user consuming the copier template.

@yajo yajo added this to the v6.0.0 milestone Sep 26, 2020
@yajo yajo modified the milestones: v6.0.0, v6.1.0 Nov 20, 2021
@yajo yajo removed the planned label May 21, 2022
@brpaz
Copy link

brpaz commented Jan 30, 2023

@yajo I Just discovered copier after trying so many similar tools, and I am loving it so far. :)

My only "complain" until now is the lack of the multi-choice option that I used in another tool.

I can work around using multiple boolean questions, but if I have a big list of options, I think it´s less efficient.

For example, I am building a template for generating "GitHub files" like Readme, LICENSE, CODE_OF_CONDUCT, actions, etc. I want the user to select what files to generate. Having to ask all this in multiple questions, when they could simply toggle an option in a list, is a bit boring and more time-consuming IMO.

Just want to ask if this issue can still be considered.

Thank you.

@yajo yajo added the good first issue Easy things for newbies label Jan 31, 2023
@yajo
Copy link
Member

yajo commented Jan 31, 2023

Obrigado for your kind words!

This issue is in the roadmap, so it will come at some point. As you see above, we were waiting for the big refactoring done for v6, but that's already done so adding this feature should be easy now. It's just a matter of adding support for a new kind of question and using the corresponding prompt from the questionary lib that now powers copier.

However I'm giving priority to community PRs, bug and UX fixes and I do not think that I'll be working on this soon.

I labeled the issue as good for newbies. Maybe someone wants to contribute the feature, and that'll make it land faster!

@brpaz
Copy link

brpaz commented Jan 31, 2023

yes After I wrote this comment, I looked a bit in the code and found that questionary lib, which I checked that supports multiple choices.

I might give a shot at this and try to submit a PR as it´s basically the only thing missing so far for my use cases :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Easy things for newbies
Projects
None yet
4 participants