Skip to content

Commit 9cf8fdd

Browse files
authored
Merge pull request #10 from stuartleeks/sl/update-fix
Fix update bugs
2 parents f61f559 + d0babbe commit 9cf8fdd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/devcontainer/update.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ func createUpdateCommand() *cobra.Command {
3636
return
3737
}
3838

39-
fmt.Print("\n\n UPDATE AVAILABLE \n \n Release notes: "+latest.ReleaseNotes+" \n Do you want to update to: ", latest.Version, "? (y/n): ")
39+
fmt.Printf("\n\n UPDATE AVAILABLE: %s \n \n Release notes: %s\n", latest.Version, latest.ReleaseNotes)
40+
41+
if checkOnly {
42+
return
43+
}
44+
45+
fmt.Print("Do you want to update? (y/n): ")
4046
if !yes {
4147
input, err := bufio.NewReader(os.Stdin).ReadString('\n')
4248
if err != nil || (input != "y\n" && input != "y\r\n") {
@@ -58,7 +64,7 @@ func createUpdateCommand() *cobra.Command {
5864
},
5965
}
6066
cmd.Flags().BoolVar(&checkOnly, "check-only", false, "Check for an update without applying")
61-
cmd.Flags().BoolVarP(&checkOnly, "yes", "y", false, "Automatically apply any updates (i.e. answer yes) ")
67+
cmd.Flags().BoolVarP(&yes, "yes", "y", false, "Automatically apply any updates (i.e. answer yes) ")
6268

6369
return cmd
6470
}

0 commit comments

Comments
 (0)