Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

How to default a confirmation? #294

Closed
richardltc opened this issue Jul 10, 2020 · 4 comments
Closed

How to default a confirmation? #294

richardltc opened this issue Jul 10, 2020 · 4 comments

Comments

@richardltc
Copy link

Is there a way that we can default a confirmation to either true or false?

Thanks

@MarkusFreitag
Copy link
Contributor

Yes, you can set the default when creating a survey.Confirm component like this:

  var answer bool
  prompt := &survey.Confirm{
    Message: "Do you like cookies?",
    Default: true, // default to true/yes because who doesn't like them
  }
  survey.AskOne(prompt, &answer)

@infalmo
Copy link
Contributor

infalmo commented Oct 5, 2020

Close this since its resolved? @richardltc

@richardltc
Copy link
Author

richardltc commented Oct 5, 2020 via email

@richardltc
Copy link
Author

richardltc commented Feb 11, 2021 via email

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

No branches or pull requests

4 participants