diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-16 00:53:52 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-16 00:53:52 +0200 |
| commit | 9a77de31dc9759708ce9c2d14ea7c0876c214e71 (patch) | |
| tree | 9bd8bab97206468bdd1eed3d77481e37d3fe75e7 /internal/engine/engine.go | |
| parent | 1b39b2683eb820560ba882936d4818af0dcfcec7 (diff) | |
| download | krino-9a77de31dc9759708ce9c2d14ea7c0876c214e71.tar.gz krino-9a77de31dc9759708ce9c2d14ea7c0876c214e71.zip | |
config and engine can load with unsaved text
Diffstat (limited to 'internal/engine/engine.go')
| -rw-r--r-- | internal/engine/engine.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/engine/engine.go b/internal/engine/engine.go index 958e4f9..cc776e6 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -80,7 +80,14 @@ type Rule struct { // Engine and every diagnostic: krino never acts on a configuration it only // partly understood. Duplicate names are ignored after their first use. func Load(mainFile string, names ...string) (*Engine, []*config.Diag) { - cfg, errs := config.Load(mainFile, dedupeNames(names)...) + return LoadWith(mainFile, nil, names...) +} + +// LoadWith is Load with some configuration files' text supplied by the +// caller (config.LoadWith): the GUI checks unsaved editor text with it, +// compiled exactly as a run would compile it (GUI design ยง1.3). +func LoadWith(mainFile string, overrides map[string][]byte, names ...string) (*Engine, []*config.Diag) { + cfg, errs := config.LoadWith(mainFile, overrides, dedupeNames(names)...) if cfg == nil { return nil, errs } |
