diff options
author | Donald Hunter <donald.hunter@gmail.com> | 2024-01-30 01:34:57 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-01 08:19:19 +0300 |
commit | fe09ae5fb93be371a72d1b2ac62fb3eead51a728 (patch) | |
tree | 1bcb6f6b3e4f7b7915348d5e2fb0480145af415b /tools | |
parent | 9d6429c33976fcce0d46124a9151314137687e0f (diff) | |
download | linux-fe09ae5fb93be371a72d1b2ac62fb3eead51a728.tar.xz |
tools/net/ynl: Add type info to struct members in generated docs
Extend the ynl doc generator to include type information for struct
members, ignoring the pad type.
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240129223458.52046-13-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/net/ynl/ynl-gen-rst.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/net/ynl/ynl-gen-rst.py b/tools/net/ynl/ynl-gen-rst.py index 262d88f88696..927407b3efb3 100755 --- a/tools/net/ynl/ynl-gen-rst.py +++ b/tools/net/ynl/ynl-gen-rst.py @@ -189,12 +189,19 @@ def parse_operations(operations: List[Dict[str, Any]]) -> str: def parse_entries(entries: List[Dict[str, Any]], level: int) -> str: """Parse a list of entries""" + ignored = ["pad"] lines = [] for entry in entries: if isinstance(entry, dict): # entries could be a list or a dictionary + field_name = entry.get("name", "") + if field_name in ignored: + continue + type_ = entry.get("type") + if type_: + field_name += f" ({inline(type_)})" lines.append( - rst_fields(entry.get("name", ""), sanitize(entry.get("doc", "")), level) + rst_fields(field_name, sanitize(entry.get("doc", "")), level) ) elif isinstance(entry, list): lines.append(rst_list_inline(entry, level)) |