Add dry-run flag and implement AUR support
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user