1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-04-09 10:34:00 +00:00

Use hasPrefix

This commit is contained in:
Yang, Bo 2023-05-07 11:37:00 -07:00
parent 7bed4edc21
commit c0dbe755a4

View file

@ -168,15 +168,15 @@ let
type = flake-parts-lib.mkPerSystemType module;
};
# Returns the inputs of another input that matches `outPath`, or by default
# the root inputs if the `outPath` is not an input.
# Returns the inputs of another input that includes `outPath`, or by default
# the root inputs if the `outPath` does not belong to an input.
findInputsByOutPath = outPath: inputs:
let
findInputByOutPath = outPath:
lib.attrsets.concatMapAttrs
(inputName: input:
(
if input.outPath == toString outPath then
if lib.strings.hasPrefix input.outPath (toString outPath) then
input
else
findInputByOutPath outPath input.inputs or { }