Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate prompts and output for pushing tags in cut #321

Merged
merged 1 commit into from
Jan 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions src/rebar3_hex_cut.erl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
%% @doc `rebar3 hex cut' - Publish with git tag and version bump features
%% @doc `rebar3 hex cut' - Publish with git tag and version bump features
%%
%% Increments tags and publishes.
%%
%% Incrementing and tagging are both optional features of this provider.
%% Incrementing and tagging are both optional features of this provider.
%%
%% By default you'll be prompted what type of increment to make to the version or it can be supplied as an argument to
%% the command `-i', `--increment' switch.
%% the command `-i', `--increment' switch.
%%
%% `cut' will also optionally create version bump commit, create a tag with a name corresponding to the new version, and
%% prompt you if you'd like to push the tag up to your git repository.
%% prompt you if you'd like to push the tag up to your git repository.
%%
%%
%% Below is a full example of `cut' in action :
%%
%% Below is a full example of `cut' in action :
%%
%% ```
%% rebar3 hex cut
Expand Down Expand Up @@ -53,15 +53,15 @@
%% Push new tag to origin? ("Y")>
%% ===> Pushing new tag v0.1.4...
%% '''
%%
%%
%% <ul>
%% <li>`--repo' - Specify the repository to work with. This option is required when
%% you have multiple repositories configured, including organizations. The argument must
%% <li>`--repo' - Specify the repository to work with. This option is required when
%% you have multiple repositories configured, including organizations. The argument must
%% be a fully qualified repository name (e.g, `hexpm', `hexpm:my_org', `my_own_hexpm').
%% Defaults to `hexpm'.
%% </li>
%% <li>`-i', `--increment' - Specify the type of version increment to perform without being prompted at runtime.
%% Supported types are :
%% <li>`-i', `--increment' - Specify the type of version increment to perform without being prompted at runtime.
%% Supported types are :
%% <ul>
%% <li><b>major</b></li>
%% <li><b>minor</b></li>
Expand Down Expand Up @@ -151,13 +151,7 @@ cut(State, Repo, App, #{} = Args) ->

case try_publish(State, Repo, App, Args) of
{ok, _State} ->
case rebar3_hex_io:ask("Push new tag to origin?", boolean, "Y") of
true ->
maybe_push_tag(Version),
{ok, State};
false ->
{ok, State}
end;
maybe_push_tag(NewVersion);
_ ->
delete_tag(NewVersion),
{ok, State}
Expand Down