Skip to content

Commit

Permalink
✨ changed to trim filepathes if it overflows the specified length in …
Browse files Browse the repository at this point in the history
…commit message (src/cmd/root.go)
  • Loading branch information
HidemaruOwO committed Aug 26, 2024
1 parent 66bed3b commit 1e74b49
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,35 @@ func gitCommit(prefix string, subject string) {
wg.Wait()

_, emoji := lib.IncludeGitimoji(prefix)
appConfig := lib.GetAppConfig()

aliases := lib.GetAppConfig()
gitChange = strings.ReplaceAll(gitChange, "\n", ", ")

var commitMsg string
var commigMessage string

if *aliases.WriteEmoji {
var message string

if *appConfig.WriteEmoji {
if emoji != "" {
prefix = emoji
commitMsg = fmt.Sprintf("%s %s (%s)", prefix, subject, gitChange)
} else {
commitMsg = fmt.Sprintf(":%s: %s (%s)", prefix, subject, gitChange)
prefix = fmt.Sprintf(":%s:", prefix)
}
}

if *appConfig.UseLimitPathesLength {
if *appConfig.LimitPathesLength < len([]rune(gitChange)) {
gitChange = fmt.Sprintf("%s...", gitChange[:*appConfig.LimitPathesLength])
}

message = fmt.Sprintf("%s (%s)", subject, gitChange)
} else {
commitMsg = fmt.Sprintf(":%s: %s (%s)", prefix, subject, gitChange)
message = fmt.Sprintf("%s", subject)
}

cmd := exec.Command("git", "commit", "-m", commitMsg)
commigMessage = fmt.Sprintf("%s %s", prefix, message)

cmd := exec.Command("git", "commit", "-m", commigMessage)
_, err = cmd.Output()
if err != nil {
log.ErrorExit(err)
Expand Down

0 comments on commit 1e74b49

Please sign in to comment.