feat(zellij): implement PlanForce

This commit is contained in:
MDietermann
2026-04-14 22:06:10 +02:00
parent 47064338c8
commit 4ed257bbd1
2 changed files with 63 additions and 2 deletions

View File

@@ -3,7 +3,6 @@ package zellij
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
@@ -111,5 +110,26 @@ func (m Module) Verify(ctx context.Context) error {
}
func (m Module) PlanForce(ctx context.Context) (module.Plan, error) {
return module.Plan{}, errors.New("PlanForce not implemented")
actions := []module.Action{{
Description: "pacman -S (force) zellij",
Kind: module.ActionPackageInstall,
Exec: func(ctx context.Context) error { return m.pm.Reinstall(ctx, []string{"zellij"}) },
}}
if m.cfg.ConfigURL != "" {
p, err := configPath()
if err != nil {
return module.Plan{}, err
}
actions = append(actions, module.Action{
Description: "redownload zellij config (force)",
Kind: module.ActionFileWrite,
Exec: func(ctx context.Context) error {
if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil {
return err
}
return platform.Download(ctx, m.cfg.ConfigURL, p, 0o644)
},
})
}
return module.Plan{Actions: actions}, nil
}