File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ mod system_information;
33use clap:: Parser ;
44use local_ip_address:: list_afinet_netifas;
55use std:: collections:: { HashMap , HashSet } ;
6+ use std:: path:: PathBuf ;
67use sysinfo:: { Disks , System } ;
78
89use crate :: system_information:: { SystemInformation , SystemNetworkInfo } ;
@@ -23,6 +24,9 @@ struct Opts {
2324 require_equals = true ,
2425 ) ]
2526 loop_interval : Option < stackable_operator:: time:: Duration > ,
27+
28+ #[ clap( long, short = 'o' ) ]
29+ output : Option < PathBuf > ,
2630}
2731
2832fn main ( ) {
@@ -88,6 +92,9 @@ fn main() {
8892
8993 let serialized = serde_json:: to_string_pretty ( & system_information) . unwrap ( ) ;
9094 println ! ( "{}" , serialized) ;
95+ if let Some ( output_path) = & opts. output {
96+ std:: fs:: write ( output_path, & serialized) . unwrap ( ) ;
97+ }
9198
9299 // TODO:
93100 // Current time
You can’t perform that action at this time.
0 commit comments