Add git helper (#612)

Add support to tea login with helper same another tools and `gh`

Reviewed-on: https://gitea.com/gitea/tea/pulls/612
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
Co-committed-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
This commit is contained in:
Matheus Sampaio Queiroga
2024-08-26 11:34:36 +00:00
committed by 6543
parent a35bf931ae
commit 2984ad4964
9 changed files with 226 additions and 186 deletions

View File

@ -127,6 +127,24 @@ func promptMultiSelect(prompt string, options []string, customVal string) ([]str
return promptCustomVal(prompt, customVal, selection)
}
// promptSelectV2 creates a generic select prompt
func promptSelectV2(prompt string, options []string) (string, error) {
if len(options) == 0 {
return "", nil
}
var selection string
promptA := &survey.Select{
Message: prompt,
Options: options,
VimMode: true,
Default: options[0],
}
if err := survey.AskOne(promptA, &selection); err != nil {
return "", err
}
return selection, nil
}
// promptSelect creates a generic select prompt, with processing of custom values or none-option.
func promptSelect(prompt string, options []string, customVal, noneVal string) (string, error) {
var selection string