浏览代码

Merge pull request #766 from project-fifo/utf8-tree

Utf8 tree
pull/767/head
Tristan Sloughter 9 年前
父节点
当前提交
c5825978a0
共有 1 个文件被更改,包括 16 次插入10 次删除
  1. +16
    -10
      src/rebar_prv_deps_tree.erl

+ 16
- 10
src/rebar_prv_deps_tree.erl 查看文件

@ -49,26 +49,32 @@ print_deps_tree(SrcDeps, Verbose, State) ->
ProjectAppNames = [{rebar_app_info:name(App)
,rebar_app_info:original_vsn(App)
,project} || App <- rebar_state:project_apps(State)],
io:setopts([{encoding, unicode}]),
case dict:find(root, D) of
{ok, Children} ->
print_children(-1, lists:keysort(1, Children++ProjectAppNames), D, Verbose);
print_children("", lists:keysort(1, Children++ProjectAppNames), D, Verbose);
error ->
print_children(-1, lists:keysort(1, ProjectAppNames), D, Verbose)
print_children("", lists:keysort(1, ProjectAppNames), D, Verbose)
end.
print_children(_, [], _, _) ->
ok;
print_children(Indent, [{Name, Vsn, Source} | Rest], Dict, Verbose) ->
[io:format("| ") || _ <- lists:seq(0, Indent, 2)],
io:format("|- "),
io:format("~s-~s (~s)~n", [Name, Vsn, type(Source, Verbose)]),
print_children(Prefix, [{Name, Vsn, Source} | Rest], Dict, Verbose) ->
Prefix1 = case Rest of
[] ->
io:format("~s└─ ", [Prefix]),
[Prefix, " "];
_ ->
io:format("~s├─ ", [Prefix]),
[Prefix, ""]
end,
io:format("~s~s (~s)~n", [Name, Vsn, type(Source, Verbose)]),
case dict:find(Name, Dict) of
{ok, Children} ->
print_children(Indent+2, lists:keysort(1, Children), Dict, Verbose),
print_children(Indent, Rest, Dict, Verbose);
print_children(Prefix1, lists:keysort(1, Children), Dict, Verbose),
print_children(Prefix, Rest, Dict, Verbose);
error ->
print_children(Indent, Rest, Dict, Verbose)
print_children(Prefix, Rest, Dict, Verbose)
end.
type(project, _) ->

正在加载...
取消
保存