engine: resources: Add a line resource

Simple enough for the common cases. It just needs some tests.
This commit is contained in:
James Shubin
2025-05-06 02:22:39 -04:00
parent f2a6a6769f
commit 0e34f13cce
2 changed files with 414 additions and 0 deletions

43
examples/lang/line0.mcl Normal file
View File

@@ -0,0 +1,43 @@
line "add" { # name isn't important
file => "/tmp/lines1",
state => "exists",
content => "hello",
}
line "remove" {
file => "/tmp/lines2",
state => "absent",
content => "hello",
}
line "multiple" {
file => "/tmp/lines3",
state => "exists",
content => "hello\nworld\n",
}
exec "nonl" {
cmd => "echo -n hello > /tmp/lines4",
shell => "/bin/bash",
creates => "/tmp/lines4",
Before => Line["nonl"],
}
line "nonl" {
file => "/tmp/lines4",
state => "exists",
content => "hello",
}
exec "rmnl" {
cmd => "echo hello > /tmp/lines5 && echo -n world >> /tmp/lines5",
shell => "/bin/bash",
creates => "/tmp/lines5",
Before => Line["rmnl"],
}
line "rmnl" {
file => "/tmp/lines5",
state => "absent",
content => "hello",
}