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
//// Clad returns the first error it encounters. If multiple fields have errors, only the first one will be returned.
114
+
////
115
+
//// ```gleam
116
+
//// // arguments: ["--count", "three"]
117
+
////
118
+
//// let args =
119
+
//// arg_decoder()
120
+
//// |> clad.decode(arguments)
121
+
//// let assert Error([DecodeError("field", "nothing", ["--name"])]) = args
122
+
//// ```
123
+
////
124
+
//// If a field has a default value, but the argument is supplied with the incorrect type, an error will be returned rather than falling back on the default value.
125
+
////
126
+
//// ```gleam
127
+
//// // arguments: ["-n", "Lucy" "-c", "three"]
128
+
////
129
+
//// let args =
130
+
//// arg_decoder()
131
+
//// |> clad.decode(arguments)
132
+
//// let assert Error([DecodeError("Int", "String", ["-c"])]) = args
133
+
//// ```
111
134
112
135
importclad/internal/args
113
136
importgleam/dict
@@ -302,13 +325,13 @@ pub fn bool(
302
325
303
326
/// A decoder that decodes Bool arguments. Assigns a default value if the
304
327
/// argument is missing.
305
-
///
328
+
///
306
329
/// This function is only necessary if you want to assign the default value as `True`.
0 commit comments