Files
Gittea-plugin/cmd/commit.go
Spencer b7ea167786 Initial commit: gtea CLI tool
Go CLI that wraps the Gitea API and git to create repos, commit,
push, and pull without leaving the terminal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 14:11:34 -04:00

29 lines
592 B
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var commitMsg string
var commitCmd = &cobra.Command{
Use: "commit",
Short: "Stage all changes and commit",
RunE: func(cmd *cobra.Command, args []string) error {
if commitMsg == "" {
return fmt.Errorf("commit message required — use -m \"your message\"")
}
if err := runGit(".", "add", "-A"); err != nil {
return err
}
return runGit(".", "commit", "-m", commitMsg)
},
}
func init() {
commitCmd.Flags().StringVarP(&commitMsg, "message", "m", "", "Commit message")
_ = commitCmd.MarkFlagRequired("message")
}