mirror of https://gitlab.com/gitlab-org/cli.git
70672aff18
this allows testing error paths in code: Pass an `error` type as the Value, it will be reflect-checked if it is an error, and be returned ```golang as, restoreAsk := prompt.InitAskStubber() defer restoreAsk() as.Stub([]*prompt.QuestionStub{ { Name: "assignee", Value: errors.New("meant to fail"), }, }) ``` Example code that will benefit: ```golang var confirmAnswers []string err := prompt.MultiSelect(&confirmAnswers, "metadata", "Which metadata types to add?", options) if err != nil { return nil, fmt.Errorf("could not prompt: %w", err) } ``` |
||
---|---|---|
.. | ||
prompt.go | ||
stubber.go |