From e15d768062834181bb36b73fe607208ef4c6cd8c Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 14 Sep 2012 09:24:48 -0500 Subject: make sure that app_info can print a representation of itself --- src/rcl_app_info.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/rcl_app_info.erl') diff --git a/src/rcl_app_info.erl b/src/rcl_app_info.erl index eaf3302..d53c1aa 100644 --- a/src/rcl_app_info.erl +++ b/src/rcl_app_info.erl @@ -47,7 +47,8 @@ active_deps/1, active_deps/2, library_deps/1, - library_deps/2]). + library_deps/2, + format/1]). -export_type([t/0]). @@ -125,7 +126,14 @@ library_deps(AppInfo=#app_info_t{}, LibraryDeps) when erlang:is_list(LibraryDeps) -> AppInfo#app_info_t{library_deps=LibraryDeps}. - +-spec format(t()) -> iolist(). +format(#app_info_t{name=Name, vsn=Vsn, dir=Dir, + active_deps=Deps, library_deps=LibDeps}) -> + [erlang:atom_to_list(Name), "-", Vsn, ": ", Dir, "\n", + rcl_util:indent(1), "Active Dependencies:\n", + [[rcl_util:indent(2), erlang:atom_to_list(Dep), ",\n"] || Dep <- Deps], + rcl_util:indent(1), "Library Dependencies:\n", + [[rcl_util:indent(2), erlang:atom_to_list(LibDep), ",\n"] || LibDep <- LibDeps]]. -- cgit v1.2.3