Define main-relative input options
This commit is contained in:
@@ -7,10 +7,16 @@ type Input struct {
|
||||
Source Source
|
||||
Imports bool
|
||||
Filesystem *FilesystemContext
|
||||
MainRelative *MainRelativeContext
|
||||
Destination Path
|
||||
PlacementMode PlacementMode
|
||||
}
|
||||
|
||||
type MainRelativeContext struct {
|
||||
Fallback *FilesystemContext
|
||||
RequireBase bool
|
||||
}
|
||||
|
||||
// Underlay contains strictly composed contributions at one precedence tier.
|
||||
type Underlay struct{ Inputs []Input }
|
||||
|
||||
@@ -22,6 +28,7 @@ type LayeredOptions[T any] struct {
|
||||
Underlays []Underlay
|
||||
Overlay string
|
||||
OverlayFilesystem *FilesystemContext
|
||||
OverlayFallback *FilesystemContext
|
||||
Overrides []Override
|
||||
}
|
||||
|
||||
@@ -37,13 +44,14 @@ func LoadLayered[T any](main Input, secrets SecretBinding, supplied ...LayeredOp
|
||||
}
|
||||
request := loadRequest[T]{
|
||||
main: loadInput{
|
||||
source: main.Source, imports: main.Imports, filesystem: main.Filesystem,
|
||||
source: main.Source, imports: main.Imports, filesystem: main.Filesystem, mainRelative: main.MainRelative,
|
||||
destination: main.Destination.clone(), placementMode: main.PlacementMode,
|
||||
},
|
||||
definition: options.Definition, sourceVersionMode: options.SourceVersionMode,
|
||||
importDefaults: options.ImportDefaults,
|
||||
overlay: options.Overlay,
|
||||
overlayFilesystem: options.OverlayFilesystem,
|
||||
overlayFallback: options.OverlayFallback,
|
||||
overrides: append([]Override(nil), options.Overrides...),
|
||||
underlays: make([]loadGroup, len(options.Underlays)),
|
||||
}
|
||||
@@ -51,7 +59,7 @@ func LoadLayered[T any](main Input, secrets SecretBinding, supplied ...LayeredOp
|
||||
request.underlays[index].inputs = make([]loadInput, len(underlay.Inputs))
|
||||
for inputIndex, input := range underlay.Inputs {
|
||||
request.underlays[index].inputs[inputIndex] = loadInput{
|
||||
source: input.Source, imports: input.Imports, filesystem: input.Filesystem,
|
||||
source: input.Source, imports: input.Imports, filesystem: input.Filesystem, mainRelative: input.MainRelative,
|
||||
destination: input.Destination.clone(), placementMode: input.PlacementMode,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user