feat(platform): add Reinstall helpers to Pacman and Yay
This commit is contained in:
@@ -52,6 +52,17 @@ func (y *Yay) Install(ctx context.Context, pkgs []string) error {
|
||||
return y.Runner.Run(ctx, "yay", args...)
|
||||
}
|
||||
|
||||
// Reinstall runs `yay -S --noconfirm <pkgs...>` WITHOUT `--needed`, forcing
|
||||
// yay/pacman to re-fetch and reinstall the packages even if already present.
|
||||
// Used by the `--force` flag to bypass idempotency.
|
||||
func (y *Yay) Reinstall(ctx context.Context, pkgs []string) error {
|
||||
if len(pkgs) == 0 {
|
||||
return nil
|
||||
}
|
||||
args := append([]string{"-S", "--noconfirm"}, pkgs...)
|
||||
return y.Runner.Run(ctx, "yay", args...)
|
||||
}
|
||||
|
||||
func shellQuote(s string) string {
|
||||
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user