File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ type ProjectOptions struct {
81
81
// Callbacks to retrieve metadata information during parse defined before
82
82
// creating the project
83
83
Listeners []loader.Listener
84
+ // ResourceLoaders manages support for remote resources
85
+ ResourceLoaders []loader.ResourceLoader
84
86
}
85
87
86
88
type ProjectOptionsFn func (* ProjectOptions ) error
@@ -347,8 +349,9 @@ func WithResolvedPaths(resolve bool) ProjectOptionsFn {
347
349
// WithResourceLoader register support for ResourceLoader to manage remote resources
348
350
func WithResourceLoader (r loader.ResourceLoader ) ProjectOptionsFn {
349
351
return func (o * ProjectOptions ) error {
352
+ o .ResourceLoaders = append (o .ResourceLoaders , r )
350
353
o .loadOptions = append (o .loadOptions , func (options * loader.Options ) {
351
- options .ResourceLoaders = append ( options .ResourceLoaders , r )
354
+ options .ResourceLoaders = o .ResourceLoaders
352
355
})
353
356
return nil
354
357
}
@@ -390,8 +393,14 @@ func (o *ProjectOptions) GetWorkingDir() (string, error) {
390
393
if o .WorkingDir != "" {
391
394
return filepath .Abs (o .WorkingDir )
392
395
}
396
+ PATH:
393
397
for _ , path := range o .ConfigPaths {
394
398
if path != "-" {
399
+ for _ , l := range o .ResourceLoaders {
400
+ if l .Accept (path ) {
401
+ break PATH
402
+ }
403
+ }
395
404
absPath , err := filepath .Abs (path )
396
405
if err != nil {
397
406
return "" , err
You can’t perform that action at this time.
0 commit comments