This commit is contained in:
Craig Everett 2019-12-24 08:19:09 +09:00
parent b5c072d0b0
commit afd9607a97
2 changed files with 15 additions and 12 deletions

View File

@ -299,7 +299,8 @@ done({error, Reason}) ->
init:stop(1); init:stop(1);
done({error, Info, Code}) -> done({error, Info, Code}) ->
ok = zx_daemon:idle(), ok = zx_daemon:idle(),
ok = tell(error, "Error: ~160tp: ~160tp", [Info, Code]), Message = "Operation failed with: ~160tp",
ok = tell(error, Message, [Info]),
init:stop(Code). init:stop(Code).
@ -760,7 +761,7 @@ upgrade() ->
tell("Upgraded to ~s.", [NewString]); tell("Upgraded to ~s.", [NewString]);
{ok, Available} when Available < Current -> {ok, Available} when Available < Current ->
{ok, AvailableString} = zx_lib:version_to_string(Available), {ok, AvailableString} = zx_lib:version_to_string(Available),
Message = "Local version is newer than ~s. Nothing to do.~n", Message = "Local version is newer than ~s. Nothing to do.",
ok = tell(Message, [AvailableString]); ok = tell(Message, [AvailableString]);
Error -> Error ->
Error Error

View File

@ -88,8 +88,8 @@ initialize(P = #project{type = escript}) ->
initialize(P = #project{type = lib, id = none}) -> initialize(P = #project{type = lib, id = none}) ->
initialize(P#project{id = ask_package_id()}); initialize(P#project{id = ask_package_id()});
initialize(P = #project{id = none}) -> initialize(P = #project{id = none}) ->
ID = {_, AppMod, _} = ask_package_id(), ID = {_, Name, _} = ask_package_id(),
initialize(P#project{id = ID, appmod = AppMod}); initialize(P#project{id = ID, appmod = list_to_atom(Name)});
initialize(P = #project{prefix = none}) -> initialize(P = #project{prefix = none}) ->
initialize(P#project{prefix = ask_prefix()}); initialize(P#project{prefix = ask_prefix()});
initialize(P = #project{type = app, appmod = none}) -> initialize(P = #project{type = app, appmod = none}) ->
@ -202,7 +202,7 @@ initialize(P = #project{type = Type,
"[ 7] Copyright Holder's Email: ~ts~n" "[ 7] Copyright Holder's Email: ~ts~n"
"[ 8] License : ~ts~n" "[ 8] License : ~ts~n"
"[ 9] Prefix : ~ts~n" "[ 9] Prefix : ~ts~n"
"[10] AppMod : ~ts~n" "[10] AppMod : ~tw~n"
"[11] Repo URL : ~ts~n" "[11] Repo URL : ~ts~n"
"[12] Website URL : ~ts~n" "[12] Website URL : ~ts~n"
"[13] Description : ~ts~n" "[13] Description : ~ts~n"
@ -706,7 +706,7 @@ update_version(Realm, Name, OldVersion, NewVersion, OldMeta) ->
list_realms() -> list_realms() ->
case zx_lib:list_realms() of case zx_lib:list_realms() of
[] -> tell(error, "Oh noes! No realms are configured!~n"); [] -> tell(error, "Oh noes! No realms are configured!");
Realms -> lists:foreach(fun(R) -> io:format("~ts~n", [R]) end, Realms) Realms -> lists:foreach(fun(R) -> io:format("~ts~n", [R]) end, Realms)
end. end.
@ -719,7 +719,7 @@ list_realms() ->
list_packages(Realm) -> list_packages(Realm) ->
{ok, ID} = zx_daemon:list(Realm), {ok, ID} = zx_daemon:list(Realm),
case zx_daemon:wait_result(ID) of case zx_daemon:wait_result(ID) of
{ok, []} -> tell(error, "No packages available.~n"); {ok, []} -> tell(error, "No packages available.");
{ok, Packages} -> lists:foreach(print_package(Realm), Packages); {ok, Packages} -> lists:foreach(print_package(Realm), Packages);
{error, bad_realm} -> {error, "Unconfigured realm or bad realm name.", 22}; {error, bad_realm} -> {error, "Unconfigured realm or bad realm name.", 22};
{error, timeout} -> {error, "Request timed out.", 62}; {error, timeout} -> {error, "Request timed out.", 62};
@ -745,7 +745,7 @@ list_versions(PackageString) ->
list_versions2({Realm, Name, Version}) -> list_versions2({Realm, Name, Version}) ->
{ok, ID} = zx_daemon:list(Realm, Name, Version), {ok, ID} = zx_daemon:list(Realm, Name, Version),
case zx_daemon:wait_result(ID) of case zx_daemon:wait_result(ID) of
{ok, []} -> tell(error, "No versions available.~n"); {ok, []} -> tell(error, "No versions available.");
{ok, Versions} -> lists:foreach(fun print_version/1, Versions); {ok, Versions} -> lists:foreach(fun print_version/1, Versions);
{error, bad_realm} -> {error, "Bad realm name.", 22}; {error, bad_realm} -> {error, "Bad realm name.", 22};
{error, bad_package} -> {error, "Bad package name.", 22}; {error, bad_package} -> {error, "Bad package name.", 22};
@ -785,10 +785,12 @@ describe(PackageString) ->
describe2(PackageID) -> describe2(PackageID) ->
{ok, ID} = zx_daemon:describe(PackageID), {ok, ID} = zx_daemon:describe(PackageID),
case zx_daemon:wait_result(ID) of case zx_daemon:wait_result(ID) of
{ok, Description} -> describe3(Description); {ok, Description} -> describe3(Description);
{error, bad_realm} -> {error, "Unconfigured realm or bad realm name.", 22}; {error, bad_realm} -> {error, "Unconfigured realm or bad realm name.", 22};
{error, timeout} -> {error, "Request timed out.", 62}; {error, bad_package} -> {error, "Bad package name.", 22};
{error, network} -> {error, "Network problem connecting to realm.", 101} {error, bad_version} -> {error, "Bad version.", 22};
{error, timeout} -> {error, "Request timed out.", 62};
{error, network} -> {error, "Network problem connecting to realm.", 101}
end. end.
describe3({description, describe3({description,