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>
This commit is contained in:
28
cmd/commit.go
Normal file
28
cmd/commit.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user