feat(fonts): implement PlanForce to reinstall all fonts via yay
This commit is contained in:
@@ -3,7 +3,6 @@ package fonts
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -83,5 +82,20 @@ 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")
|
||||
if len(m.fonts) == 0 {
|
||||
return module.Plan{}, nil
|
||||
}
|
||||
fonts := append([]string{}, m.fonts...)
|
||||
return module.Plan{Actions: []module.Action{
|
||||
{
|
||||
Description: "ensure yay installed",
|
||||
Kind: module.ActionPackageInstall,
|
||||
Exec: func(ctx context.Context) error { return m.aur.EnsureInstalled(ctx) },
|
||||
},
|
||||
{
|
||||
Description: "yay -S (force) " + strings.Join(fonts, ", "),
|
||||
Kind: module.ActionPackageInstall,
|
||||
Exec: func(ctx context.Context) error { return m.aur.Reinstall(ctx, fonts) },
|
||||
},
|
||||
}}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user