Skip to content

tweak secret set to allow prompting#3499

Merged
vilmibm merged 1 commit intotrunkfrom
secret-prompt
Apr 28, 2021
Merged

tweak secret set to allow prompting#3499
vilmibm merged 1 commit intotrunkfrom
secret-prompt

Conversation

@vilmibm
Copy link
Contributor

@vilmibm vilmibm commented Apr 23, 2021

This PR augments gh secret set to prompt in the event that no secret body is provided. This case was formerly an error, so I don't think it qualifies as a breaking change.

This closes a gap in secret set I've been meaning to get to since it initially released. Originally I had a whole interactive wizard for this, but realized all anyone really wants is the ability to paste a secret body (instead of putting it in a file).

Before:

gh secret set foo
# => error since nothing on STDIN and no --body

After:

gh secret set foo
? Paste your secret: *****
✓ Set secret foo for vilmibm/testing

Using STDIN still works as before (gh secret set foo < secret.txt).

There's no issue for this (I think), it's just been taking up space in my mental TODO list for months.

@vilmibm vilmibm requested review from mislav and samcoe April 23, 2021 18:13
if err != nil {
return nil, err
}
fmt.Fprintln(opts.IO.Out)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't Survey take care of printing the newline after the prompt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

usually yes, but i was seeing bizarre behavior with the password prompt. It printed a newline and then some tab characters and then output continued after the tabs. Manually printing a new line fixed it 🤷

@vilmibm vilmibm merged commit d5954e2 into trunk Apr 28, 2021
@samcoe samcoe deleted the secret-prompt branch July 13, 2021 14:38
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