diff --git a/pkgs/oizys/cmd/update.go b/pkgs/oizys/cmd/update.go index 2b66e50..adbf0bc 100644 --- a/pkgs/oizys/cmd/update.go +++ b/pkgs/oizys/cmd/update.go @@ -16,24 +16,29 @@ var updateCmd = &cobra.Command{ Short: "update and run nixos rebuild", Run: func(cmd *cobra.Command, args []string) { run := github.GetLastUpdateRun() + md, err := github.GetUpateSummary(run.GetID()) + if err != nil { + log.Fatal(err) + } + fmt.Println(md) if preview { - md, err := github.GetUpateSummary(run.GetID()) - if err != nil { - log.Fatal(err) - } - fmt.Println(md) - if !ui.Confirm("proceed with system update?") { - os.Exit(0) - } + os.Exit(0) + } + if !yes && !ui.Confirm("proceed with system update?") { + os.Exit(0) } oizys.UpdateRepo() oizys.NixosRebuild("switch") }, } -var preview bool +var ( + preview bool + yes bool +) func init() { rootCmd.AddCommand(updateCmd) updateCmd.Flags().BoolVar(&preview, "preview", false, "confirm nix store diff") + updateCmd.Flags().BoolVar(&yes, "yes", false, "reply yes to all confirm prompts") }