mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05:58 -05:00
feat: add path.get-directory-name helper for consistent directory name extraction
This commit is contained in:
@@ -133,5 +133,18 @@ in
|
|||||||
#@ Path -> String
|
#@ Path -> String
|
||||||
get-output-name = path:
|
get-output-name = path:
|
||||||
builtins.unsafeDiscardStringContext (get-parent-directory path);
|
builtins.unsafeDiscardStringContext (get-parent-directory path);
|
||||||
|
|
||||||
|
## Get the directory name for flake outputs.
|
||||||
|
## Example Usage:
|
||||||
|
## ```nix
|
||||||
|
## get-directory-name /templates/foo
|
||||||
|
## ```
|
||||||
|
## Result:
|
||||||
|
## ```nix
|
||||||
|
## "foo"
|
||||||
|
## ```
|
||||||
|
#@ Path -> String
|
||||||
|
get-directory-name = path:
|
||||||
|
builtins.unsafeDiscardStringContext (baseNameOf path);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ in
|
|||||||
description = flake-attrs.description or null;
|
description = flake-attrs.description or null;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = builtins.unsafeDiscardStringContext (baseNameOf template);
|
name = snowfall-lib.path.get-directory-name template;
|
||||||
path = template;
|
path = template;
|
||||||
}
|
}
|
||||||
// (if description != null then { inherit description; } else { });
|
// (if description != null then { inherit description; } else { });
|
||||||
|
|||||||
Reference in New Issue
Block a user