public async Task Browse(BrowseParameters parameters) { var issuesResult = await _issuesFacade.ListIssues(new ListIssuesParameters(parameters.Project) { IssuesIds = new[] { parameters.IssueId } }); if (issuesResult.IsFailure) { _outputPresenter.ShowError("Failed to browse to issue", issuesResult.Error); return; } var firstIssue = issuesResult.Value.FirstOrDefault(); if (firstIssue == null) { _outputPresenter.ShowMessage($"Issue #{parameters.IssueId} was not found in project {parameters.Project}"); return; } try { _browser.Open(firstIssue.WebUrl); } catch (Win32Exception ex) { _outputPresenter.ShowError($"Failed to open {firstIssue.WebUrl}: {ex}"); } }
public async Task CreateIssue(CreateIssueParameters parameters) { var issueResult = await _gitLabFacade.CreateIssue(parameters); if (issueResult.IsFailure) { _presenter.ShowError("Failed to create issue", issueResult.Error); return; } _presenter.ShowSuccess($"Successfully created issue #{issueResult.Value}"); }
public async Task CreateMergeRequest(CreateMergeRequestParameters parameters) { var mergeRequestResult = await _gitLabFacade.CreateMergeRequest(parameters); if (mergeRequestResult.IsFailure) { _presenter.ShowError("Failed to create merge request", mergeRequestResult.Error); return; } _presenter.ShowSuccess($"Successfully created merge request #{mergeRequestResult.Value}"); }
public async Task <int> Launch(string[] args) { try { IVisitableOption visitable = _parser.Parse(args); if (visitable == null) { return(ExitCode.InvalidArguments); } await visitable.Accept(_optionsVisitor); } catch (Exception ex) { _outputPresenter.ShowError("Unexpected error has occured", ex.ToString()); return(ExitCode.UnexpectedFailure); } finally { WaitForInput(); } return(ExitCode.Success); }
private void ShowError(Result result) => _outputPresenter.ShowError(result.Error);