lib: add types.flagInt + defaultNullOpts.mkIntFlag

Either `0` or `1`, but can be coerced from a boolean definition to
support legacy definitions.

When coerced, a warning is printed
This commit is contained in:
Matt Sturgeon 2024-07-08 10:29:31 +01:00
parent 2de406d972
commit 555035ef79
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 17 additions and 2 deletions

View file

@ -187,6 +187,8 @@ rec {
# Unsigned: >=0
mkUnsignedInt' = args: mkNullableWithRaw' (args // { type = types.ints.unsigned; });
mkUnsignedInt = pluginDefault: description: mkUnsignedInt' { inherit pluginDefault description; };
mkFlagInt = pluginDefault: description: mkFlagInt' { inherit pluginDefault description; };
mkFlagInt' = args: mkNullableWithRaw' (args // { type = types.intFlag; });
mkBool' = args: mkNullableWithRaw' (args // { type = types.bool; });
mkBool = pluginDefault: description: mkBool' { inherit pluginDefault description; };
mkStr' = args: mkNullableWithRaw' (args // { type = types.str; });