File tree Expand file tree Collapse file tree 2 files changed +33
-18
lines changed Expand file tree Collapse file tree 2 files changed +33
-18
lines changed Original file line number Diff line number Diff line change 11package ast
22
3+ import (
4+ "gopkg.in/yaml.v3"
5+
6+ "github.com/go-task/task/v3/errors"
7+ )
8+
39type Prompt []string
410
5- func (p * Prompt ) UnmarshalYAML (unmarshal func (any ) error ) error {
6- var m []string
7- err := unmarshal (& m )
8- if err == nil {
9- * p = m
11+ func (p * Prompt ) UnmarshalYAML (node * yaml.Node ) error {
12+ switch node .Kind {
13+ case yaml .ScalarNode :
14+ var str string
15+ if err := node .Decode (& str ); err != nil {
16+ return errors .NewTaskfileDecodeError (err , node )
17+ }
18+ * p = []string {str }
19+ return nil
20+ case yaml .SequenceNode :
21+ var list []string
22+ if err := node .Decode (& list ); err != nil {
23+ return errors .NewTaskfileDecodeError (err , node )
24+ }
25+ * p = list
1026 return nil
1127 }
12-
13- var s string
14- err = unmarshal (& s )
15- if err != nil {
16- return err
17- }
18-
19- * p = []string {s }
20- return nil
28+ return errors .NewTaskfileDecodeError (nil , node ).WithTypeMessage ("prompt" )
2129}
Original file line number Diff line number Diff line change 6060 },
6161 "prompt" : {
6262 "description" : " One or more prompts that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks." ,
63- "type" : " array" ,
64- "items" : {
65- "type" : " string"
66- }
63+ "oneOf" : [
64+ {
65+ "type" : " string"
66+ },
67+ {
68+ "type" : " array" ,
69+ "items" : {
70+ "type" : " string"
71+ }
72+ }
73+ ]
6774 },
6875 "summary" : {
6976 "description" : " A longer description of the task. This is displayed when calling `task --summary [task]`." ,
You can’t perform that action at this time.
0 commit comments