GitRoot
craft your forge, build your project, grow your community freely
1// SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
2//
3// SPDX-License-Identifier: MIT
4
5package model
6
7type Plugin interface {
8 Init(repoName string, confHasChanged bool, serializedConf string) error
9 StartCommit(commit Commit) error
10 AddFile(path string) error
11 ModFile(fromPath string, toPath string) error
12 DelFile(path string) error
13 EndCommit(commit Commit) error
14 Finish() error
15}
16
17type PluginOption struct {
18 Reporter func(report Report) error
19}
20
21type PluginOptionWith = func(opt PluginOption) PluginOption
22
23func WithPluginReporter(reporter func(report Report) error) PluginOptionWith {
24 return func(opt PluginOption) PluginOption {
25 return PluginOption{Reporter: reporter}
26 }
27}