File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 2
2
// Licensed under the MIT License.
3
3
4
4
use serde:: Serialize ;
5
+ use std:: fmt:: Display ;
5
6
use std:: string:: ToString ;
6
7
7
8
/// Returns information about the operating system.
@@ -48,6 +49,16 @@ pub enum Family {
48
49
Windows ,
49
50
}
50
51
52
+ impl Display for Family {
53
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
54
+ match self {
55
+ Family :: Linux => write ! ( f, "Linux" ) ,
56
+ Family :: MacOS => write ! ( f, "macOS" ) ,
57
+ Family :: Windows => write ! ( f, "Windows" ) ,
58
+ }
59
+ }
60
+ }
61
+
51
62
const ID : & str = "https://developer.microsoft.com/json-schemas/dsc/os_info/20230303/Microsoft.Dsc.OS_Info.schema.json" ;
52
63
53
64
impl OsInfo {
@@ -69,7 +80,7 @@ impl OsInfo {
69
80
let version = os_info. version ( ) . to_string ( ) ;
70
81
let name = Some (
71
82
match & architecture {
72
- Some ( arch) => format ! ( "{family:? } {version} {arch}" ) ,
83
+ Some ( arch) => format ! ( "{family} {version} {arch}" ) ,
73
84
None => format ! ( "{family:?} {version}" ) ,
74
85
}
75
86
) ;
You can’t perform that action at this time.
0 commit comments