blob: 73d8990bc77cdd18f147b5e22ae3d4f3f96ee50c [file] [log] [blame]
package source
import "context"
var (
FlagGitwebURLPattern = "https://gerrit.hackerspace.pl/plugins/gitiles/hscloud/+/%s/%s"
)
type Source interface {
IsFile(ctx context.Context, path string) (bool, error)
ReadFile(ctx context.Context, path string) ([]byte, error)
IsDirectory(ctx context.Context, path string) (bool, error)
WebLinks(fpath string) []WebLink
}
type WebLink struct {
Kind string
LinkLabel string
LinkURL string
}
type SourceProvider interface {
Source(ctx context.Context, rev string) (Source, error)
}
type singleRefProvider struct {
source Source
}
func (s *singleRefProvider) Source(ctx context.Context, rev string) (Source, error) {
return s.source, nil
}
func NewSingleRefProvider(s Source) SourceProvider {
return &singleRefProvider{s}
}