MCPcopy Index your code
hub / github.com/cli/cli / Confirm

Method Confirm

internal/prompter/prompter.go:222–243  ·  view source on GitHub ↗
(prompt string, defaultValue bool)

Source from the content-addressed store, hash-verified

220}
221
222func (p *accessiblePrompter) Confirm(prompt string, defaultValue bool) (bool, error) {
223 result := defaultValue
224
225 if defaultValue {
226 prompt = p.addDefaultsToPrompt(prompt, []string{"yes"})
227 } else {
228 prompt = p.addDefaultsToPrompt(prompt, []string{"no"})
229 }
230
231 form := p.newForm(
232 huh.NewGroup(
233 huh.NewConfirm().
234 Title(prompt).
235 Value(&result),
236 ),
237 )
238
239 if err := form.Run(); err != nil {
240 return false, err
241 }
242 return result, nil
243}
244
245func (p *accessiblePrompter) AuthToken() (string, error) {
246 var result string

Callers

nothing calls this directly

Calls 5

addDefaultsToPromptMethod · 0.95
newFormMethod · 0.95
ValueMethod · 0.80
TitleMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected