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

Dynamic creation of choice variable #1744

Open
alexandersm opened this issue Jun 23, 2022 · 3 comments
Open

Dynamic creation of choice variable #1744

alexandersm opened this issue Jun 23, 2022 · 3 comments
Labels
enhancement This issue/PR relates to a feature request.
Milestone

Comments

@alexandersm
Copy link

Description:

I have the following variables in cookiecutter.json file

  "_site_locations": {
    "zone1": [
      "SiteA",
      "SiteB",
      "SiteC"
    ],
    "zone2": [
      "SiteD",
      "SiteE"
    ]
  },

  "zone": ["zone1", "zone2"],
  "site" : [ "{{ cookiecutter._site_locations.get(cookiecutter.zone) }}" ],


My idea was to show the list of choices for site which is dynamically generated according to the selection made in zone

But in fact I'm getting the following results:

Select zone:
1 - zone1
2 - zone2
Choose from 1, 2 [1]: 1
Select site:
1 - ['SiteA', 'SiteB', 'SiteC']
Choose from 1 [1]:

Is there a way to fix that and show 3 choice items in site ?

@liortct
Copy link
Contributor

liortct commented Aug 27, 2022

I fix this issue in PR #1768.
Now the prompt will locks like that:

image
But, notice that the cookiecutter.json should looks like that:

{
 "_site_locations": {
    "zone1": [
      "SiteA",
      "SiteB",
      "SiteC"
    ],
    "zone2": [
      "SiteD",
      "SiteE"
    ]
  },

  "zone": ["zone1", "zone2"],
  "site" : "{{ cookiecutter._site_locations.get(cookiecutter.zone) }}"
}

I advice to close this issue after the PR will merge.

@GreasyAvocado
Copy link

Anyone knows when this will be merged?

@cookiecutter cookiecutter deleted a comment from liortct Jun 13, 2023
@ericof ericof added the enhancement This issue/PR relates to a feature request. label Jun 13, 2023
@ericof ericof added this to the 3.0.0 milestone Jun 13, 2023
@liortct
Copy link
Contributor

liortct commented Nov 27, 2023

@ericof , I solve this issue in #1768 . Lets work on this PR

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

No branches or pull requests

4 participants