You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc-util/main.libsonnet
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -119,11 +119,30 @@
119
119
120
120
'#argument': d.obj('Utilities for creating function arguments'),
121
121
argument:: {
122
-
'#new': d.fn('new creates a new function argument, taking the name, the type and optionally a default value', [d.arg('name', d.T.string), d.arg('type', d.T.string), d.arg('default', d.T.any)]),
123
-
new(name, type, default=null): {
122
+
'#new': d.fn(|||
123
+
`new` creates a new function argument, taking the `name`, the `type`. Optionally it
124
+
can take a `default` value and `enum`-erate potential values.
125
+
126
+
Examples:
127
+
128
+
```jsonnet
129
+
[
130
+
d.argument.new('foo', d.T.string),
131
+
d.argument.new('bar', d.T.string, default='loo'),
132
+
d.argument.new('baz', d.T.number, enums=[1,2,3]),
133
+
]
134
+
```
135
+
|||, [
136
+
d.arg('name', d.T.string),
137
+
d.arg('type', d.T.string),
138
+
d.arg('default', d.T.any),
139
+
d.arg('enums', d.T.array),
140
+
]),
141
+
new(name, type, default=null, enums=null): {
124
142
name: name,
125
143
type: type,
126
144
default: default,
145
+
enums: enums,
127
146
},
128
147
},
129
148
'#arg': self.argument['#new'] + self.func.withHelp('`arg` is a shorthand for `argument.new`'),
0 commit comments