@@ -27,6 +27,8 @@ struct ResetProp {
2727 context : bool ,
2828 #[ argh( switch, short = 'n' , long = none) ]
2929 skip_svc : bool ,
30+ #[ argh( switch, short = 'c' , long = "compact" ) ]
31+ compact : bool ,
3032 #[ argh( option, short = 'f' ) ]
3133 file : Option < Utf8CString > ,
3234 #[ argh( option, short = 'd' , long = "delete" ) ]
@@ -59,6 +61,7 @@ General flags:
5961 -h,--help show this message
6062 -v,--verbose print verbose output to stderr
6163 -w switch to wait mode
64+ -c,--compact compact property area (optional: context label)
6265
6366Read mode flags:
6467 -p also read persistent properties from storage
@@ -177,6 +180,16 @@ impl ResetProp {
177180 ret
178181 }
179182
183+ fn compact ( & self ) -> bool {
184+ if let Some ( context) = self . args . first ( ) {
185+ debug ! ( "resetprop: compact property area [{context}]" ) ;
186+ SYS_PROP . compact_context ( context)
187+ } else {
188+ debug ! ( "resetprop: compact property area" ) ;
189+ SYS_PROP . compact ( )
190+ }
191+ }
192+
180193 fn wait ( & self ) {
181194 let key = & self . args [ 0 ] ;
182195 let val = self . args . get ( 1 ) . map ( |s| & * * s) ;
@@ -227,7 +240,11 @@ impl ResetProp {
227240 }
228241
229242 fn run ( self ) -> LoggedResult < ( ) > {
230- if self . wait_mode {
243+ if self . compact {
244+ if !self . compact ( ) {
245+ return log_err ! ( ) ;
246+ }
247+ } else if self . wait_mode {
231248 self . wait ( ) ;
232249 } else if let Some ( file) = & self . file {
233250 self . load_file ( file) ?;
@@ -269,6 +286,9 @@ pub fn resetprop_main(argc: i32, argv: *mut *mut c_char) -> i32 {
269286 }
270287 special_mode += 1 ;
271288 }
289+ if cli. compact {
290+ special_mode += 1 ;
291+ }
272292 if cli. file . is_some ( ) {
273293 special_mode += 1 ;
274294 }
0 commit comments