Avoid exiting with error when trying to install the same dep twice by giopetris · Pull Request #4536 · cli/cli · GitHub
Skip to content

Avoid exiting with error when trying to install the same dep twice#4536

Closed
giopetris wants to merge 1 commit into
cli:trunkfrom
giopetris:avoid-exit-error
Closed

Avoid exiting with error when trying to install the same dep twice#4536
giopetris wants to merge 1 commit into
cli:trunkfrom
giopetris:avoid-exit-error

Conversation

@giopetris

Copy link
Copy Markdown

Fixes #4463

Before if you ran gh extension install <some-dep> twice, on the second attempt it was exiting with the error code 1, now it just prints the error message but terminates the program successfully (code 0).

@giopetris giopetris requested a review from a team as a code owner October 15, 2021 18:00
@giopetris giopetris requested review from samcoe and removed request for a team October 15, 2021 18:00
@andreyvital

Copy link
Copy Markdown

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@giopetris Thanks for the contribution. While this code works I think it would be simpler to keep the logic of checkValidExtension the same but return a new error type such as AlreadyInstalledError in the case where the extension is already installed. That way the code at extension/command.go:108 just needs to handle that specific error case and providing the user a warning like

if opts.IO.IsStdoutTTY() {
 fmt.Fprintf(opts.IO.ErrOut, "%s Extension %s is already installed\n", cs.WarningIcon(), extName)
}
return nil

Does that make sense? Let me know if you have questions about that direction.

@samcoe samcoe self-assigned this Oct 27, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@cli cli deleted a comment Nov 22, 2021
@samcoe

samcoe commented Dec 8, 2021

Copy link
Copy Markdown
Contributor

@giopetris Do you plan on continuing work on this PR? If not I will close it to allow other community members to work on the issue.

@giopetris

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh extension install returns an error in case extension exist

4 participants