feat(zellij): implement PlanForce
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user