mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
lib/types.nix: add nonEmptyStr
This commit is contained in:
parent
ba1af18d27
commit
a3c5f0cba8
@ -287,6 +287,13 @@ rec {
|
|||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nonEmptyStr = mkOptionType {
|
||||||
|
name = "nonEmptyStr";
|
||||||
|
description = "non-empty string";
|
||||||
|
check = x: str.check x && builtins.match "[ \t\n]*" x == null;
|
||||||
|
inherit (str) merge;
|
||||||
|
};
|
||||||
|
|
||||||
strMatching = pattern: mkOptionType {
|
strMatching = pattern: mkOptionType {
|
||||||
name = "strMatching ${escapeNixString pattern}";
|
name = "strMatching ${escapeNixString pattern}";
|
||||||
description = "string matching the pattern ${pattern}";
|
description = "string matching the pattern ${pattern}";
|
||||||
|
Loading…
Reference in New Issue
Block a user