@@ -105,13 +105,26 @@ func GetInfo(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command, ar
105105 return
106106 }
107107
108+ versionStr := response .GetVersion ().GetVersionStr ()
109+ // VersionStr will be empty if the core was built with go build directly instead of make.
110+ // This happens because the Makefile takes care of pushing the version number.
111+ if len (versionStr ) == 0 || versionStr == "0.0.0" {
112+ versionStr = "dev"
113+ }
114+ versionStr = green (versionStr )
115+
116+ revisionStr := response .GetVersion ().GetBuild ()
117+ if len (revisionStr ) > 0 {
118+ revisionStr = fmt .Sprintf ("revision %s" , green (revisionStr ))
119+ }
120+
108121 _ , _ = fmt .Fprintf (o , "instance name: %s\n " , response .GetInstanceName ())
109- _ , _ = fmt .Fprintf (o , "endpoint: %s\n " , viper .GetString ("endpoint" ))
110- _ , _ = fmt .Fprintf (o , "core version: %s %s build %s\n " , response .GetVersion ().GetProductName (), response . GetVersion (). GetVersionStr (), response . GetVersion (). GetBuild () )
122+ _ , _ = fmt .Fprintf (o , "endpoint: %s\n " , green ( viper .GetString ("endpoint" ) ))
123+ _ , _ = fmt .Fprintf (o , "core version: %s %s %s\n " , response .GetVersion ().GetProductName (), versionStr , revisionStr )
111124 _ , _ = fmt .Fprintf (o , "framework id: %s\n " , response .GetFrameworkId ())
112- _ , _ = fmt .Fprintf (o , "environments count: %d \n " , response .GetEnvironmentsCount ())
113- _ , _ = fmt .Fprintf (o , "active tasks count: %d \n " , response .GetTasksCount ())
114- _ , _ = fmt .Fprintf (o , "global state: %s\n " , response .GetState ())
125+ _ , _ = fmt .Fprintf (o , "environments count: %s \n " , green ( response .GetEnvironmentsCount () ))
126+ _ , _ = fmt .Fprintf (o , "active tasks count: %s \n " , green ( response .GetTasksCount () ))
127+ _ , _ = fmt .Fprintf (o , "global state: %s\n " , colorGlobalState ( response .GetState () ))
115128
116129 return nil
117130}
@@ -204,9 +217,12 @@ func ShowEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Com
204217
205218 env := response .GetEnvironment ()
206219 tasks := env .GetTasks ()
207- fmt .Fprintf (o , "environment id: %s\n " , env .GetId ())
208- fmt .Fprintf (o , "created: %s\n " , formatTimestamp (env .GetCreatedWhen ()))
209- fmt .Fprintf (o , "state: %s\n " , colorState (env .GetState ()))
220+ rnString := formatRunNumber (env .GetCurrentRunNumber ())
221+
222+ _ , _ = fmt .Fprintf (o , "environment id: %s\n " , env .GetId ())
223+ _ , _ = fmt .Fprintf (o , "created: %s\n " , formatTimestamp (env .GetCreatedWhen ()))
224+ _ , _ = fmt .Fprintf (o , "state: %s\n " , colorState (env .GetState ()))
225+ _ , _ = fmt .Fprintf (o , "run number: %s\n " , rnString )
210226
211227 if printTasks {
212228 fmt .Fprintln (o , "" )
@@ -247,9 +263,12 @@ func ControlEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.
247263 return
248264 }
249265
250- fmt .Fprintln (o , "transition complete" )
251- fmt .Fprintf (o , "environment id: %s\n " , response .GetId ())
252- fmt .Fprintf (o , "state: %s\n " , colorState (response .GetState ()))
266+ rnString := formatRunNumber (response .GetCurrentRunNumber ())
267+
268+ _ , _ = fmt .Fprintln (o , "transition complete" )
269+ _ , _ = fmt .Fprintf (o , "environment id: %s\n " , response .GetId ())
270+ _ , _ = fmt .Fprintf (o , "state: %s\n " , colorState (response .GetState ()))
271+ _ , _ = fmt .Fprintf (o , "run number: %s\n " , rnString )
253272 return
254273}
255274
0 commit comments