Skip to content

Commit

Permalink
Manipulate similar elements in similar places
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Jun 16, 2024
1 parent 25bdc5d commit 9653b30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/rebar3_hex_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ reset_password(HexConfig, User) ->
response(Res).

me(HexConfig) ->
Res = hex_api_user:me(HexConfig),
Res = hex_api_user:me(to_hex_core_config(HexConfig)),
response(Res).

key_add(HexConfig, <<KeyName/binary>>, Perms) ->
Expand Down Expand Up @@ -69,11 +69,11 @@ key_delete_all(HexConfig) ->
response(Res).

test_key(HexConfig, Perms) ->
Res = hex_api_auth:test(HexConfig, Perms),
Res = hex_api_auth:test(to_hex_core_config(HexConfig), Perms),
response(Res).

publish(HexConfig, Tarball, Opts) ->
Res = hex_api_release:publish(HexConfig, Tarball, Opts),
Res = hex_api_release:publish(to_hex_core_config(HexConfig), Tarball, Opts),
response(Res).

delete_release(HexConfig, Name, Version) ->
Expand Down Expand Up @@ -160,3 +160,7 @@ join_lists(Sep, List) ->

to_binary(Subject) ->
rebar_utils:to_binary(Subject).

to_hex_core_config(#{name := Name} = HexConfig) ->
NewHexConfig = HexConfig#{repo_name := Name},
maps:remove(name, NewHexConfig).
2 changes: 1 addition & 1 deletion src/rebar3_hex_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ whoami(#{name := Name} = Repo, State) ->
undefined ->
?RAISE(not_authenticated);
ReadKey ->
case rebar3_hex_client:me(maps:remove(name, Repo#{api_key => ReadKey})) of
case rebar3_hex_client:me(Repo#{api_key => ReadKey}) of
{ok, #{<<"username">> := Username,
<<"email">> := Email}} ->
rebar3_hex_io:say("~ts : ~ts (~ts)", [Name, Username, Email]),
Expand Down

0 comments on commit 9653b30

Please sign in to comment.