Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Added error message when command execution fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed May 4, 2022
1 parent d0bb2f9 commit d2b1d35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func canUseGitCommand() bool {
func cdGitRootDir() error {
out, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
if err != nil {
print.Err(string(out))
return err
}
return os.Chdir(strings.Split(string(out), "\n")[0])
Expand All @@ -146,6 +147,7 @@ func exists(path string) bool {
func getAuthorsAlphabeticalOrder() ([]string, error) {
out, err := exec.Command("git", "log", "--pretty=format:%an<%ae>").Output()
if err != nil {
print.Err(string(out))
return nil, err
}

Expand Down Expand Up @@ -186,6 +188,7 @@ func authorsInfo() ([]authorInfo, error) {
for _, v := range authorInfos {
out, err := exec.Command("git", "log", "--author="+v.mail, "--numstat", "--pretty=", "--no-merges", defalutBranch).Output()
if err != nil {
print.Err(string(out))
print.Err(err)
return nil, err
}
Expand Down Expand Up @@ -217,6 +220,7 @@ func authorsInfo() ([]authorInfo, error) {
func defaultBranch() (string, error) {
out, err := exec.Command("git", "remote", "show", "origin").Output()
if err != nil {
print.Err(string(out))
return "", errors.New("can not get default branch name")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmdinfo/cmdinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

const (
name = "contributor"
version = "1.1.1"
version = "1.1.2"
)

// Version return command version.
Expand Down

0 comments on commit d2b1d35

Please sign in to comment.