@@ -37,6 +37,7 @@ pub(crate) async fn version_command(
3737 version : response. version ,
3838 git_sha : response. git_sha ,
3939 build_date : response. build_date ,
40+ profile : response. profile ,
4041 os : response. os ,
4142 arch : response. arch ,
4243 uptime_secs : response. uptime_secs ,
@@ -98,6 +99,7 @@ struct ClientVersionInfo {
9899 version : & ' static str ,
99100 git_sha : & ' static str ,
100101 build_date : & ' static str ,
102+ profile : & ' static str ,
101103 os : & ' static str ,
102104 arch : & ' static str ,
103105}
@@ -108,6 +110,7 @@ enum ServerVersionInfo {
108110 version : Option < String > ,
109111 git_sha : Option < String > ,
110112 build_date : Option < String > ,
113+ profile : Option < String > ,
111114 os : Option < String > ,
112115 arch : Option < String > ,
113116 uptime_secs : Option < i64 > ,
@@ -123,11 +126,16 @@ fn client_info() -> ClientVersionInfo {
123126 version : env ! ( "CARGO_PKG_VERSION" ) ,
124127 git_sha : env ! ( "FABRO_GIT_SHA" ) ,
125128 build_date : env ! ( "FABRO_BUILD_DATE" ) ,
129+ profile : env ! ( "FABRO_BUILD_PROFILE" ) ,
126130 os : std:: env:: consts:: OS ,
127131 arch : std:: env:: consts:: ARCH ,
128132 }
129133}
130134
135+ fn is_non_release_profile ( profile : & str ) -> bool {
136+ !profile. is_empty ( ) && profile != "release"
137+ }
138+
131139fn format_server_target ( target : & ServerTarget ) -> String {
132140 match target {
133141 ServerTarget :: HttpUrl { api_url, .. } => api_url. clone ( ) ,
@@ -140,6 +148,7 @@ fn json_output(client: &ClientVersionInfo, server: &ServerVersionInfo) -> Value
140148 "version" : client. version,
141149 "git_sha" : client. git_sha,
142150 "build_date" : client. build_date,
151+ "profile" : client. profile,
143152 "os" : client. os,
144153 "arch" : client. arch,
145154 } ) ;
@@ -151,6 +160,7 @@ fn json_output(client: &ClientVersionInfo, server: &ServerVersionInfo) -> Value
151160 version,
152161 git_sha,
153162 build_date,
163+ profile,
154164 os,
155165 arch,
156166 uptime_secs,
@@ -165,6 +175,9 @@ fn json_output(client: &ClientVersionInfo, server: &ServerVersionInfo) -> Value
165175 if let Some ( build_date) = build_date {
166176 server_map. insert ( "build_date" . to_string ( ) , Value :: String ( build_date. clone ( ) ) ) ;
167177 }
178+ if let Some ( profile) = profile {
179+ server_map. insert ( "profile" . to_string ( ) , Value :: String ( profile. clone ( ) ) ) ;
180+ }
168181 if let Some ( os) = os {
169182 server_map. insert ( "os" . to_string ( ) , Value :: String ( os. clone ( ) ) ) ;
170183 }
@@ -193,6 +206,9 @@ fn print_text_output(client: &ClientVersionInfo, server: &ServerVersionInfo) {
193206 println ! ( " Version: {}" , client. version) ;
194207 println ! ( " Git SHA: {}" , client. git_sha) ;
195208 println ! ( " Build Date: {}" , client. build_date) ;
209+ if is_non_release_profile ( client. profile ) {
210+ println ! ( " Profile: {}" , client. profile) ;
211+ }
196212 println ! ( " OS/Arch: {}/{}" , client. os, client. arch) ;
197213 println ! ( ) ;
198214
@@ -202,6 +218,7 @@ fn print_text_output(client: &ClientVersionInfo, server: &ServerVersionInfo) {
202218 version,
203219 git_sha,
204220 build_date,
221+ profile,
205222 os,
206223 arch,
207224 uptime_secs,
@@ -213,6 +230,9 @@ fn print_text_output(client: &ClientVersionInfo, server: &ServerVersionInfo) {
213230 " Build Date: {}" ,
214231 build_date. as_deref( ) . unwrap_or( "unknown" )
215232 ) ;
233+ if let Some ( profile) = profile. as_deref ( ) . filter ( |p| is_non_release_profile ( p) ) {
234+ println ! ( " Profile: {profile}" ) ;
235+ }
216236 println ! (
217237 " OS/Arch: {}/{}" ,
218238 os. as_deref( ) . unwrap_or( "unknown" ) ,
@@ -256,6 +276,7 @@ mod tests {
256276 version : Some ( "1.0.0" . into ( ) ) ,
257277 git_sha : None ,
258278 build_date : None ,
279+ profile : None ,
259280 os : None ,
260281 arch : None ,
261282 uptime_secs : None ,
@@ -267,6 +288,7 @@ mod tests {
267288 version : Some ( "1.2.0" . into ( ) ) ,
268289 git_sha : None ,
269290 build_date : None ,
291+ profile : None ,
270292 os : None ,
271293 arch : None ,
272294 uptime_secs : None ,
@@ -281,6 +303,7 @@ mod tests {
281303 version : None ,
282304 git_sha : None ,
283305 build_date : None ,
306+ profile : None ,
284307 os : None ,
285308 arch : None ,
286309 uptime_secs : None ,
0 commit comments