feat: drop-in support for custom templates
User templates can now be added without rebuilding: drop a script into ~/.config/motd-assist/templates/ and reference it from a preset via "install": "<filename>". Same-name files override built-ins; new files are picked up by the running TUI via 'r'. `motd-assist templates` lists known templates and creates the drop-in directory. Apply plans now embed the resolved template content (Plan.ResolveContents) so the sudo/root process never needs to read user config; snapshots store installed script content so restore works under sudo as well. Validation rejects plans with unresolved content.
This commit is contained in:
parent
d56659e21a
commit
303c49b484
10 changed files with 375 additions and 48 deletions
|
|
@ -249,6 +249,12 @@ func (m Model) applyWorking() (tea.Model, tea.Cmd) {
|
|||
m.status = "Keine Änderungen zum Anwenden"
|
||||
return m, nil
|
||||
}
|
||||
// Vorlagen-Inhalte jetzt auflösen (User-Templates liegen im eigenen
|
||||
// $HOME); der sudo-Prozess kann sie später nicht mehr lesen.
|
||||
if err := plan.ResolveContents(); err != nil {
|
||||
m.status = err.Error()
|
||||
return m, nil
|
||||
}
|
||||
m.applying = true
|
||||
m.lastSummary = plan.Summary()
|
||||
return m, applyExec(plan)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue