Skip to content

Commit

Permalink
Pretty-print describe-app information.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavisp3 committed Jan 28, 2008
1 parent 0c6f041 commit c42ad45
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/faxien/src/fax_manage.erl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe_app(Repos, TargetErtsVsn, AppName, AppVsn, Timeout) ->
fun(Repo) ->
case ewr_util:repo_consult(Repo, Suffix, Timeout) of
{ok, {application, _, Terms}} ->
io:format("~nDescribing Application: ~s~n~n ~p~n", [AppName, Terms]);
io:format("~nDescribing Application: ~s~n~n~s~n", [AppName, format_app_terms(Terms)]);
Error ->
?ERROR_MSG("consulting ~s with suffix ~s returns ~p~n", [Repo, Suffix, Error]),
Error
Expand Down Expand Up @@ -472,4 +472,22 @@ highest_vsn([]) ->
highest_vsn(Error) ->
{error, Error}.



%%--------------------------------------------------------------------
%% @private
%% @doc Return a pretty-print string version of application configuration terms.
%% @spec format_app_terms(Terms) -> string()
%% @end
%%--------------------------------------------------------------------
format_app_terms(Terms) ->
lists:concat([format_app_term(T) || T <- Terms]).

format_app_term({Key, Val}) ->
lists:concat([Key, ":\n ", format_app_val(Key, Val), "\n"]).

format_app_val(description, Val) ->
Val;
format_app_val(vsn, Val) ->
Val;
format_app_val(_Key, Val) ->
io_lib:format("~p", [Val]).

0 comments on commit c42ad45

Please sign in to comment.