diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-10 17:31:23 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-11 17:07:49 +1000 |
commit | 6fbe660f96419e27f13004b2afede5272f9eb9f7 (patch) | |
tree | 43d36ca7536404ee1df8a72ef5e754c8f5dba51d /pkg/commands | |
parent | 74320f00752926b42f0e4d6f84b3816d7a0134a9 (diff) |
full coverage for logging commands
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/branches.go | 4 | ||||
-rw-r--r-- | pkg/commands/pull_request.go | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pkg/commands/branches.go b/pkg/commands/branches.go index 62a243247..9d4bf4512 100644 --- a/pkg/commands/branches.go +++ b/pkg/commands/branches.go @@ -59,9 +59,9 @@ type CheckoutOptions struct { func (c *GitCommand) Checkout(branch string, options CheckoutOptions) error { forceArg := "" if options.Force { - forceArg = "--force " + forceArg = " --force" } - return c.OSCommand.RunCommandWithOptions(fmt.Sprintf("git checkout %s %s", forceArg, branch), oscommands.RunCommandOptions{EnvVars: options.EnvVars}) + return c.OSCommand.RunCommandWithOptions(fmt.Sprintf("git checkout%s %s", forceArg, branch), oscommands.RunCommandOptions{EnvVars: options.EnvVars}) } // GetBranchGraph gets the color-formatted graph of the log for the given branch diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go index 8bddbec50..575027229 100644 --- a/pkg/commands/pull_request.go +++ b/pkg/commands/pull_request.go @@ -90,23 +90,23 @@ func NewPullRequest(gitCommand *GitCommand) *PullRequest { } // Create opens link to new pull request in browser -func (pr *PullRequest) Create(branch *models.Branch) error { +func (pr *PullRequest) Create(branch *models.Branch) (string, error) { pullRequestURL, err := pr.getPullRequestURL(branch) if err != nil { - return err + return "", err } - return pr.GitCommand.OSCommand.OpenLink(pullRequestURL) + return pullRequestURL, pr.GitCommand.OSCommand.OpenLink(pullRequestURL) } // CopyURL copies the pull request URL to the clipboard -func (pr *PullRequest) CopyURL(branch *models.Branch) error { +func (pr *PullRequest) CopyURL(branch *models.Branch) (string, error) { pullRequestURL, err := pr.getPullRequestURL(branch) if err != nil { - return err + return "", err } - return pr.GitCommand.OSCommand.CopyToClipboard(pullRequestURL) + return pullRequestURL, pr.GitCommand.OSCommand.CopyToClipboard(pullRequestURL) } func (pr *PullRequest) getPullRequestURL(branch *models.Branch) (string, error) { |