Commit Graph

7 Commits

Author SHA1 Message Date
Leo 70672aff18 feat(pkg/prompt/stubber): allow passing an error as Value
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)
}
```
2021-01-03 09:33:25 -03:00
Leo 250296d53b feat(pkg/prompt): add `Select()` to select a single option 2021-01-02 02:23:52 -03:00
Clement Sam 83681d3864 fix(pkg/prompt): easily stub prompts 2021-01-01 15:28:33 +00:00
Leo 16efd4368d refactor(pkg/prompt): replace function literals
Function literals that only call a single function, without making any
other changes to the value of the inner function, can be removed, as
they are redundant.

Instead, the inner function, that is being called inside the outer
function should be called.

https://deepsource.io/gh/profclems/glab/run/0801fe82-1e9c-42fd-acc7-affe7f2e2fbb/go/CRT-A0018/
2020-12-28 07:29:55 -03:00
Clement Sam 3dec52d584
feat: add repo delete command (#340)
* feat: add repo delete command

* fix lint errors
2020-12-01 08:32:12 +00:00
Clement Sam a4f1655a44 feat: add labels multiselect to issue create and mr create 2020-11-30 09:51:29 +00:00
Clement Sam 8229add949 extend survey prompt for glab with customizations 2020-11-29 18:39:18 +00:00