@@ -33,6 +33,7 @@ import (
3333 "k8s.io/minikube/pkg/minikube/detect"
3434 "k8s.io/minikube/pkg/minikube/localpath"
3535 "k8s.io/minikube/pkg/minikube/out"
36+ "k8s.io/minikube/pkg/minikube/run"
3637 "k8s.io/minikube/pkg/minikube/style"
3738 "k8s.io/minikube/pkg/util/lock"
3839 "k8s.io/minikube/pkg/version"
@@ -44,30 +45,30 @@ var (
4445)
4546
4647// MaybePrintUpdateTextFromGithub prints update text if needed, from github
47- func MaybePrintUpdateTextFromGithub () {
48- maybePrintUpdateText (GithubMinikubeReleasesURL , GithubMinikubeBetaReleasesURL , lastUpdateCheckFilePath )
48+ func MaybePrintUpdateTextFromGithub (options * run. CommandOptions ) {
49+ maybePrintUpdateText (GithubMinikubeReleasesURL , GithubMinikubeBetaReleasesURL , lastUpdateCheckFilePath , options )
4950}
5051
5152// MaybePrintUpdateTextFromAliyunMirror prints update text if needed, from Aliyun mirror
52- func MaybePrintUpdateTextFromAliyunMirror () {
53- maybePrintUpdateText (GithubMinikubeReleasesAliyunURL , GithubMinikubeBetaReleasesAliyunURL , lastUpdateCheckFilePath )
53+ func MaybePrintUpdateTextFromAliyunMirror (options * run. CommandOptions ) {
54+ maybePrintUpdateText (GithubMinikubeReleasesAliyunURL , GithubMinikubeBetaReleasesAliyunURL , lastUpdateCheckFilePath , options )
5455}
5556
56- func maybePrintUpdateText (latestReleasesURL string , betaReleasesURL string , lastUpdatePath string ) {
57+ func maybePrintUpdateText (latestReleasesURL string , betaReleasesURL string , lastUpdatePath string , options * run. CommandOptions ) {
5758 latestVersion , err := latestVersionFromURL (latestReleasesURL )
5859 if err != nil {
5960 klog .Warning (err )
6061 return
6162 }
62- if ! shouldCheckURLVersion (lastUpdatePath ) {
63+ if ! shouldCheckURLVersion (lastUpdatePath , options ) {
6364 return
6465 }
6566 localVersion , err := version .GetSemverVersion ()
6667 if err != nil {
6768 klog .Warning (err )
6869 return
6970 }
70- if maybePrintBetaUpdateText (betaReleasesURL , localVersion , latestVersion , lastUpdatePath ) {
71+ if maybePrintBetaUpdateText (betaReleasesURL , localVersion , latestVersion , lastUpdatePath , options ) {
7172 return
7273 }
7374 if localVersion .Compare (latestVersion ) >= 0 {
@@ -77,8 +78,8 @@ func maybePrintUpdateText(latestReleasesURL string, betaReleasesURL string, last
7778}
7879
7980// maybePrintBetaUpdateText returns true if update text is printed
80- func maybePrintBetaUpdateText (betaReleasesURL string , localVersion semver.Version , latestFullVersion semver.Version , lastUpdatePath string ) bool {
81- if ! shouldCheckURLBetaVersion (lastUpdatePath ) {
81+ func maybePrintBetaUpdateText (betaReleasesURL string , localVersion semver.Version , latestFullVersion semver.Version , lastUpdatePath string , options * run. CommandOptions ) bool {
82+ if ! shouldCheckURLBetaVersion (lastUpdatePath , options ) {
8283 return false
8384 }
8485 latestBetaVersion , err := latestVersionFromURL (betaReleasesURL )
@@ -115,11 +116,11 @@ func printBetaUpdateText(ver semver.Version) {
115116 out .Styled (style .Tip , "To disable update notices in general, run: 'minikube config set WantUpdateNotification false'\n " )
116117}
117118
118- func shouldCheckURLVersion (filePath string ) bool {
119+ func shouldCheckURLVersion (filePath string , options * run. CommandOptions ) bool {
119120 if ! viper .GetBool (config .WantUpdateNotification ) {
120121 return false
121122 }
122- if ! viper . GetBool ( "interactive" ) {
123+ if options . NonInteractive {
123124 return false
124125 }
125126 if out .JSON {
@@ -129,12 +130,12 @@ func shouldCheckURLVersion(filePath string) bool {
129130 return time .Since (lastUpdateTime ).Hours () >= viper .GetFloat64 (config .ReminderWaitPeriodInHours )
130131}
131132
132- func shouldCheckURLBetaVersion (filePath string ) bool {
133+ func shouldCheckURLBetaVersion (filePath string , options * run. CommandOptions ) bool {
133134 if ! viper .GetBool (config .WantBetaUpdateNotification ) {
134135 return false
135136 }
136137
137- return shouldCheckURLVersion (filePath )
138+ return shouldCheckURLVersion (filePath , options )
138139}
139140
140141type operatingSystems struct {
0 commit comments