refactor(path): add get-output-name helper to eliminate duplication

This commit is contained in:
anntnzrb
2025-10-08 23:27:36 -05:00
parent 1f7af06347
commit e4771be1c1

View File

@@ -119,5 +119,19 @@ in
concatStringsSep "" (init (split-file-extension file-name))
else
file-name;
## Get the output name from a file path for flake outputs.
## This handles the unsafeDiscardStringContext pattern used throughout.
## Example Usage:
## ```nix
## get-output-name ./foo/bar/default.nix
## ```
## Result:
## ```nix
## "bar"
## ```
#@ Path -> String
get-output-name = path:
builtins.unsafeDiscardStringContext (get-parent-directory path);
};
}