mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-11 23:50:05 +01:00
types: relax filename, pathname & absolute pathname
This commit is contained in:
parent
af2da574be
commit
6bbccd8edd
1 changed files with 4 additions and 7 deletions
11
types.nix
11
types.nix
|
|
@ -247,25 +247,22 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
optionTypes = rec {
|
optionTypes = rec {
|
||||||
# POSIX.1‐2017, 3.281 Portable Filename
|
|
||||||
filename = mkOptionType {
|
filename = mkOptionType {
|
||||||
name = "POSIX portable filename";
|
name = "filename";
|
||||||
check = x: isString x && builtins.match "[0-9A-Za-z._][0-9A-Za-z._-]*" x != null;
|
check = x: isString x;
|
||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
description = "A filename";
|
description = "A filename";
|
||||||
};
|
};
|
||||||
|
|
||||||
# POSIX.1‐2017, 3.2 Absolute Pathname
|
|
||||||
absolute-pathname = mkOptionType {
|
absolute-pathname = mkOptionType {
|
||||||
name = "POSIX absolute pathname";
|
name = "absolute pathname";
|
||||||
check = x: isString x && substring 0 1 x == "/" && pathname.check x;
|
check = x: isString x && substring 0 1 x == "/" && pathname.check x;
|
||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
description = "An absolute path";
|
description = "An absolute path";
|
||||||
};
|
};
|
||||||
|
|
||||||
# POSIX.1-2017, 3.271 Pathname
|
|
||||||
pathname = mkOptionType {
|
pathname = mkOptionType {
|
||||||
name = "POSIX pathname";
|
name = "pathname";
|
||||||
check = x:
|
check = x:
|
||||||
let
|
let
|
||||||
# The filter is used to normalize paths, i.e. to remove duplicated and
|
# The filter is used to normalize paths, i.e. to remove duplicated and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue