MCPcopy Create free account
hub / github.com/cli/cli / confirmationPrompt

Function confirmationPrompt

pkg/cmd/issue/artifact/delete/delete.go:192–202  ·  view source on GitHub ↗

confirmationPrompt asks once for every artifact, naming each one, such as "Delete artifacts 2 (OAuth callback plan) and 5 (Barista feedback notes) from monalisa/monas-cafe#142?".

(lookups []lookup, issueRef string)

Source from the content-addressed store, hash-verified

190// "Delete artifacts 2 (OAuth callback plan) and 5 (Barista feedback notes)
191// from monalisa/monas-cafe#142?".
192func confirmationPrompt(lookups []lookup, issueRef string) string {
193 artifacts := make([]string, 0, len(lookups))
194 for _, l := range lookups {
195 artifacts = append(artifacts, fmt.Sprintf("%d (%s)", l.number, l.name))
196 }
197 noun := "artifact"
198 if len(artifacts) > 1 {
199 noun = "artifacts"
200 }
201 return fmt.Sprintf("Delete %s %s from %s?", noun, joinList(artifacts), issueRef)
202}
203
204// joinList joins items the way the prompt reads them: "a", "a and b", or
205// "a, b, and c".

Callers 1

deleteRunFunction · 0.85

Calls 1

joinListFunction · 0.85

Tested by

no test coverage detected