Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ee58f98c authored by Mårten Kongstad's avatar Mårten Kongstad
Browse files

aconfig: support custom `dump format` specs

Teach `dump --format=<arg>` to format the output according to a
user-defined format string. The format string now accepts these
arguments:

  - "protobuf": output all data as binary protobuf (as before)
  - "textproto": output all data as text protobuf (as before)
  - any other string: format according to the format spec, see below

Custom format spec: placeholders, enclosed in { and } and named after
the fields of ProtoParsedFlag, will be replaced by the actual values.
All other text is output verbatim. As an example:

  - "{name}={state}" -> "enabled_ro=ENABLED"

Some fields support an alternative formatting via {<field>:<format>}. As
an example:

  - "{name}={state:bool}" -> "enabled_ro=true"

Note that the text replacement does not support escaping { and }. This
means there is no way to print the string "{name}" without expanding it
to the actual flag's name. If needed this feature can be introduced in a
later CL.

For backwards compatibility, the following format strings have special
meaning and will produce an output identically to what it was before
this change:

  - "text"
  - "verbose"
  - "bool"

A follow-up CL will add a new `dump --filter=` argument to limit which
parsed flags are included in the output.

Test: atest
Bug: b/315487153
Change-Id: If7c14b5fb3e7b41ea962425078bd04b4996318f4
parent 0c6a2fac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment