feat(assignees): add set, add, and remove assignees APIs (#1045)

Implemented set, add, and remove assignees APIs.
Closes https://gitea.com/gitea/tea/issues/965 and https://gitea.com/gitea/tea/issues/966Reviewed-on: https://gitea.com/gitea/tea/pulls/1045
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Minjie Fang <wingsallen@gmail.com>
This commit is contained in:
Minjie Fang
2026-07-18 00:20:03 +00:00
committed by Lunny Xiao
parent 2d6dcd062f
commit d664c01e18
11 changed files with 434 additions and 27 deletions
+17 -1
View File
@@ -92,10 +92,26 @@ func promptDatetime(prompt string) (val *time.Time, err error) {
// promptSelect creates a generic multiselect prompt, with processing of custom values.
func promptMultiSelect(prompt string, options []string, customVal string) ([]string, error) {
opts := huh.NewOptions(makeSelectOpts(options, customVal, "")...)
return runMultiSelect(prompt, opts, customVal)
}
// promptMultiSelectWithPreselect creates a generic multiselect prompt with preselected values and processing of custom values.
func promptMultiSelectWithPreselect(prompt string, selected []string, options []string, customVal string) ([]string, error) {
opts := make([]huh.Option[string], 0, len(selected)+len(options)+1)
for _, name := range selected {
opts = append(opts, huh.NewOption(name, name).Selected(true))
}
opts = append(opts, huh.NewOptions(makeSelectOpts(options, customVal, "")...)...)
return runMultiSelect(prompt, opts, customVal)
}
func runMultiSelect(prompt string, opts []huh.Option[string], customVal string) ([]string, error) {
var selection []string
if err := huh.NewMultiSelect[string]().
Title(prompt).
Options(huh.NewOptions(makeSelectOpts(options, customVal, "")...)...).
Options(opts...).
Value(&selection).
WithTheme(theme.GetTheme()).
Run(); err != nil {