mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05:58 -05:00
refactor(path): add get-output-name helper to eliminate duplication
This commit is contained in:
@@ -119,5 +119,19 @@ in
|
|||||||
concatStringsSep "" (init (split-file-extension file-name))
|
concatStringsSep "" (init (split-file-extension file-name))
|
||||||
else
|
else
|
||||||
file-name;
|
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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user