Add dry-run flag and implement AUR support

This commit is contained in:
AI Bot
2026-04-13 21:42:11 +02:00
committed by Riyyi
parent bd789ab18d
commit 521b862919
10 changed files with 395 additions and 29 deletions
+16
View File
@@ -17,6 +17,7 @@ import (
type Config struct {
StateFiles []string
NoConfirm bool
DryRun bool
}
func main() {
@@ -38,6 +39,11 @@ func main() {
Usage: "Skip confirmation prompts",
Destination: &cfg.NoConfirm,
},
&cli.BoolFlag{
Name: "dry-run",
Usage: "Simulate the sync without making changes",
Destination: &cfg.DryRun,
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return run(cfg)
@@ -63,6 +69,16 @@ func run(cfg *Config) error {
return err
}
if cfg.DryRun {
result, err := pacman.DryRun(merged)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
return err
}
fmt.Println(output.Format(result))
return nil
}
result, err := pacman.Sync(merged)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)