@@ -15,6 +15,7 @@ enum ArgumentType {
15
15
BLOCK = 'block' ,
16
16
PURE_TOKEN = 'pure-token' ,
17
17
COMMAND = 'command' ,
18
+ ENUM = 'enum' , // temporary for backward compatibility
18
19
}
19
20
20
21
export class Argument {
@@ -36,6 +37,8 @@ export class Argument {
36
37
37
38
protected arguments : Argument [ ]
38
39
40
+ protected enum : string [ ]
41
+
39
42
constructor ( data : Record < string , any > ) {
40
43
this . stack = [ ]
41
44
this . name = data ?. name
@@ -44,12 +47,13 @@ export class Argument {
44
47
this . multiple = ! ! data ?. multiple
45
48
this . multipleToken = ! ! data ?. multiple_token
46
49
this . token = data ?. token
47
- this . display = data ?. display_text || this . name
50
+ this . display = data ?. display_text || data ?. command || this . name
51
+ this . enum = data ?. enum
48
52
// todo: why we need this?
49
53
if ( this . token === '' ) {
50
54
this . token = '""'
51
55
}
52
- this . arguments = ( ( data ?. arguments || [ ] ) as Record < string , any > [ ] )
56
+ this . arguments = ( ( data ?. arguments || data ?. block || [ ] ) as Record < string , any > [ ] )
53
57
. map ( ( childArg ) => new Argument ( childArg ) )
54
58
}
55
59
@@ -71,6 +75,9 @@ export class Argument {
71
75
case ArgumentType . ONEOF :
72
76
args += this . arguments . map ( ( arg ) => arg . syntax ( ) ) . join ( ' | ' )
73
77
break
78
+ case ArgumentType . ENUM :
79
+ args += this . enum ?. join ( ' | ' )
80
+ break
74
81
case ArgumentType . PURE_TOKEN :
75
82
break
76
83
default :
0 commit comments