aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/app/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/app/main.go')
-rw-r--r--cmd/app/main.go39
1 files changed, 31 insertions, 8 deletions
diff --git a/cmd/app/main.go b/cmd/app/main.go
index 4cb711ba..86b964e3 100644
--- a/cmd/app/main.go
+++ b/cmd/app/main.go
@@ -7,6 +7,7 @@ package main
import (
"context"
"errors"
+ "fmt"
"io"
"log"
"os"
@@ -35,7 +36,7 @@ func main() {
flagVerbose bool
flagBase string
- base, template, initial, upper, work *check.Absolute
+ base, template, initial *check.Absolute
)
c := command.New(os.Stderr, log.Printf, "app", func([]string) (err error) {
msg.SwapVerbose(flagVerbose)
@@ -50,9 +51,7 @@ func main() {
}
template = base.Append("template")
- initial = template.Append("initial")
- upper = template.Append("upper")
- work = template.Append("work")
+ initial = base.Append("initial")
return
}).Flag(
&flagVerbose,
@@ -71,7 +70,21 @@ func main() {
)
c.NewCommand(
"enter", "Enter mutable state template",
- func([]string) error {
+ func(args []string) error {
+ if len(args) != 1 {
+ dents, err := os.ReadDir(template.String())
+ if err != nil {
+ return err
+ }
+ for _, dent := range dents {
+ if !dent.IsDir() {
+ continue
+ }
+ fmt.Println(dent.Name())
+ }
+ return nil
+ }
+
config := hst.Config{
ID: "app.hakurei.mutable",
Container: &hst.ContainerConfig{
@@ -80,8 +93,8 @@ func main() {
{FilesystemConfig: &hst.FSOverlay{
Target: fhs.AbsRoot,
Lower: []*check.Absolute{initial},
- Upper: upper,
- Work: work,
+ Upper: template.Append(args[0], "upper"),
+ Work: template.Append(args[0], "work"),
}},
{FilesystemConfig: &hst.FSEphemeral{
Target: fhs.AbsTmp,
@@ -131,7 +144,17 @@ func main() {
"run", "Start the named application",
func(args []string) error {
if len(args) != 1 {
- return errors.New("run requires 1 argument")
+ dents, err := os.ReadDir(base.Append("app").String())
+ if err != nil {
+ return err
+ }
+ for _, dent := range dents {
+ if dent.IsDir() {
+ continue
+ }
+ fmt.Println(dent.Name())
+ }
+ return nil
}
var config *hst.Config