@@ -104,6 +104,7 @@ The install operation is long-running, and a network connection is required.`,
104104 `This command reports the status of your sandbox and some details concerning its connected cloud portion.
105105With the ` + "`" + `--languages flag, it will report the supported languages.` , Writer )
106106 AddBoolFlag (status , "languages" , "l" , false , "show available languages (if connected to the cloud)" )
107+ AddBoolFlag (status , "version" , "" , false , "just show the version, don't check status" )
107108
108109 undeploy := CmdBuilder (cmd , RunSandboxUndeploy , "undeploy [<package|function>...]" ,
109110 "Removes resources from the cloud portion of your sandbox" ,
@@ -195,7 +196,21 @@ func RunSandboxConnect(c *CmdConfig) error {
195196// RunSandboxStatus gives a report on the status of the sandbox (installed, up to date, connected)
196197func RunSandboxStatus (c * CmdConfig ) error {
197198 status := c .checkSandboxStatus (c )
198- if status == ErrSandboxNeedsUpgrade || status == ErrSandboxNotInstalled || status == ErrSandboxNotConnected {
199+ if status == ErrSandboxNotInstalled {
200+ return status
201+ }
202+ version , _ := c .Doit .GetBool (c .NS , "version" )
203+ if version {
204+ if status == ErrSandboxNeedsUpgrade {
205+ sandboxDir , _ := getSandboxDirectory () // we know it exists
206+ currentVersion := getCurrentSandboxVersion (sandboxDir )
207+ fmt .Fprintf (c .Out , "Current: %s, required: %s\n " , currentVersion , getMinSandboxVersion ())
208+ return nil
209+ }
210+ fmt .Fprintln (c .Out , getMinSandboxVersion ())
211+ return nil
212+ }
213+ if status == ErrSandboxNeedsUpgrade || status == ErrSandboxNotConnected {
199214 return status
200215 }
201216 if status != nil {
@@ -211,7 +226,8 @@ func RunSandboxStatus(c *CmdConfig) error {
211226 return errors .New ("Could not retrieve information about the connected namespace" )
212227 }
213228 mapResult := result .Entity .(map [string ]interface {})
214- fmt .Fprintf (c .Out , "Connected to function namespace '%s' on API host '%s'\n \n " , mapResult ["name" ], mapResult ["apihost" ])
229+ fmt .Fprintf (c .Out , "Connected to function namespace '%s' on API host '%s'\n " , mapResult ["name" ], mapResult ["apihost" ])
230+ fmt .Fprintf (c .Out , "Sandbox version is %s\n \n " , minSandboxVersion )
215231 displayRuntimes , _ := c .Doit .GetBool (c .NS , "languages" )
216232 if displayRuntimes {
217233 result , err = SandboxExec (c , "info" , "--runtimes" )
0 commit comments