Skip to content

Commit d89450a

Browse files
committed
exit command if there are not staged changes
1 parent 4a57f2a commit d89450a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cmd/commit/main.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ import (
1313
)
1414

1515
var (
16-
focusedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#6FD0FB")).Bold(true)
17-
blurredStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
18-
cursorStyle = focusedStyle.Copy()
19-
noStyle = lipgloss.NewStyle()
20-
21-
stagedFilesStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#10ffcb"))
22-
cursorModeHelpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("244"))
23-
24-
focusedButton = focusedStyle.Copy().Render("[ Commit ]")
25-
blurredButton = fmt.Sprintf("[ %s ]", blurredStyle.Render("Commit"))
16+
focusedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#6FD0FB")).Bold(true)
17+
blurredStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
18+
cursorStyle = focusedStyle.Copy()
19+
noStyle = lipgloss.NewStyle()
20+
stagedFilesStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#10ffcb"))
21+
focusedButton = focusedStyle.Copy().Render("[ Commit ]")
22+
blurredButton = fmt.Sprintf("[ %s ]", blurredStyle.Render("Commit"))
2623
)
2724

2825
type (
@@ -52,6 +49,10 @@ func initialModel() model {
5249

5350
stagedFiles := getStagedFiles()
5451

52+
if len(stagedFiles) == 0 {
53+
log.Fatal("No staged files found")
54+
}
55+
5556
result := strings.Split(branch, "/")
5657

5758
// get first and second result into separate variables

0 commit comments

Comments
 (0)