Add new dump format map in aconfig
The `aconfig dump --format map` lists aconfig keys mapped to its boolean values that represents whether the flag is enabled or not, as seen below: ``` flag.name1=true flag.name2=false ``` Test: aconfig dump --format map --cache out/soong/.intermediates/build/make/tools/aconfig/aconfig.test.flags/intermediate.pb && inspect output Bug: 306024510 Change-Id: Ic4990c168f6fa9c87869113ba695c07394adbc67
This commit is contained in:
@@ -268,6 +268,7 @@ pub enum DumpFormat {
|
||||
Verbose,
|
||||
Protobuf,
|
||||
Textproto,
|
||||
Bool,
|
||||
}
|
||||
|
||||
pub fn dump_parsed_flags(
|
||||
@@ -318,6 +319,17 @@ pub fn dump_parsed_flags(
|
||||
let s = protobuf::text_format::print_to_string_pretty(&parsed_flags);
|
||||
output.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
DumpFormat::Bool => {
|
||||
for parsed_flag in parsed_flags.parsed_flag.into_iter() {
|
||||
let line = format!(
|
||||
"{}.{}={:?}\n",
|
||||
parsed_flag.package(),
|
||||
parsed_flag.name(),
|
||||
parsed_flag.state() == ProtoFlagState::ENABLED
|
||||
);
|
||||
output.extend_from_slice(line.as_bytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(output)
|
||||
}
|
||||
|
Reference in New Issue
Block a user