sdbusplus: async: client: prettify the generated code
Make some minor whitespace changes to make the generated headers
look closer to what clang-format would generate.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ida6231d230101d570038c7e251ae34743a7949e5
diff --git a/tools/sdbusplus/method.py b/tools/sdbusplus/method.py
index 6bc76b4..47d0c33 100644
--- a/tools/sdbusplus/method.py
+++ b/tools/sdbusplus/method.py
@@ -63,10 +63,12 @@
lambda p: p.cppTypeParam(interface.name, full=True)
)
- def get_parameters_str(self, interface, defaultValue=False):
+ def get_parameters_str(
+ self, interface, defaultValue=False, join_str=",\n "
+ ):
return self.parameters_as_list(
lambda p: self.parameter(interface, p, defaultValue),
- ",\n ",
+ join_str,
)
def or_cpp_flags(self, flags):
diff --git a/tools/sdbusplus/templates/interface.client.hpp.mako b/tools/sdbusplus/templates/interface.client.hpp.mako
index bbb8538..b9d7fae 100644
--- a/tools/sdbusplus/templates/interface.client.hpp.mako
+++ b/tools/sdbusplus/templates/interface.client.hpp.mako
@@ -83,7 +83,8 @@
std::conditional_t<std::is_void_v<Proxy>,
sdbusplus::async::client_t<details::${interface.classname}>,
details::${interface.classname}<Proxy>>(
- std::forward<Args>(args)...) {}
+ std::forward<Args>(args)...)
+ {}
};
} // namespace sdbusplus::client::${interface.cppNamespacedClass()}
diff --git a/tools/sdbusplus/templates/method.client.hpp.mako b/tools/sdbusplus/templates/method.client.hpp.mako
index 6d035ca..16bbfce 100644
--- a/tools/sdbusplus/templates/method.client.hpp.mako
+++ b/tools/sdbusplus/templates/method.client.hpp.mako
@@ -16,17 +16,15 @@
*/
auto ${method.camelCase}(\
% if len(method.parameters) != 0:
-
- ${method.get_parameters_str(interface)}\
+${method.get_parameters_str(interface, join_str=", ")}\
% else:
% endif
)
{
- return proxy.template call<${method.returns_as_list(interface)}>(
- ctx, "${method.name}"\
+ return proxy.template call<\
+${method.returns_as_list(interface)}>(ctx, "${method.name}"\
% if len(method.parameters) != 0:
-,
- ${method.parameters_as_list()}\
+, ${method.parameters_as_list()}\
% else:
% endif
);