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

Use defaults as answers in headless mode #10

Merged
merged 3 commits into from
Aug 26, 2021

Conversation

jimmiebfulton
Copy link
Member

@jimmiebfulton jimmiebfulton commented Aug 26, 2021

With the following archetype.yml:

script:
  - set:
      prefix:
        prompt: "Project Prefix:"

      suffix:
        prompt: "Project Suffix:"
        default: "Service"

      service-port:
        value: 8080

      management-port:
        type: int
        default: "eighty-eighty"

This:

archetect render ~/projects/archetypes/test-archetype/ --headless -a prefix="Example"

Errors with this:

archetect: Headless mode attempted to use the default value for the `management-port` variable, however, "eighty-eighty" is not a valid value for "management-port" with type Int.

@jimmiebfulton jimmiebfulton self-assigned this Aug 26, 2021
@cnuss
Copy link

cnuss commented Aug 26, 2021

LGTM, did the following functional test...

➜  archetect git:(master) git checkout feature/implicit-defaults-in-headless-mode
➜  archetect git:(feature/implicit-defaults-in-headless-mode) cargo install --path archetect-cli/ --force

Then with the following test template:

---
script:
  - set:
      name:
        prompt: "Name?"

  - info: "Name is {{ name }}"
➜  test-template archetect render . --headless
archetect: Headless mode requires answers to be supplied for all variables, but no answer was supplied for the `name` variable.

Updated the template:

---
script:
  - set:
      name:
        prompt: "Name?"
        default: "Christian"

  - info: "Name is {{ name }}"
➜  test-template archetect render . --headless
archetect: Name is Christian
➜  test-template archetect render .
Name? [Christian] Foo
archetect: Name is Foo

@jimmiebfulton jimmiebfulton merged commit 2b2eb2c into master Aug 26, 2021
@jimmiebfulton jimmiebfulton deleted the feature/implicit-defaults-in-headless-mode branch August 26, 2021 23:09
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.

None yet

2 participants