Skip to content

add and use ConfirmDeletion in {label,repo} delete#6320

Merged
vilmibm merged 1 commit intotrunkfrom
label-prompter
Oct 4, 2022
Merged

add and use ConfirmDeletion in {label,repo} delete#6320
vilmibm merged 1 commit intotrunkfrom
label-prompter

Conversation

@vilmibm
Copy link
Contributor

@vilmibm vilmibm commented Sep 22, 2022

This PR adds a new function to surveyPrompter, ConfirmDeletion. It requires the user to type in a specific value in order to confirm that something should be deleted.

I added it to label delete and repo delete, the two places we seem to use that pattern.

@vilmibm vilmibm requested a review from a team as a code owner September 22, 2022 00:09
@vilmibm vilmibm requested review from samcoe and removed request for a team September 22, 2022 00:09
@vilmibm vilmibm mentioned this pull request Sep 22, 2022
23 tasks
Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

&result,
survey.WithValidator(
func(val interface{}) error {
if str := val.(string); !strings.EqualFold(str, requiredValue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that we're abstracting a convoluted Survey call behind a simple interface that takes just a string and returns an error 🎉

@vilmibm vilmibm merged commit c13eb9e into trunk Oct 4, 2022
@vilmibm vilmibm deleted the label-prompter branch October 4, 2022 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants