-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to get content from all directories recursively #143
Comments
Current prototype looks like this: https://github.com/fluxcd/go-git-providers/blob/main/gitprovider/client.go#L244 type FileClient interface {
// GetFiles fetch files content from specific path and branch
Get(ctx context.Context, path, branch string) ([]*CommitFile, error)
} So we could either add another method |
I would prefer having a functional option... if I'm being asked 😄 |
'course you are :D, Oh yeah an options thingy ay. Maybe type Options struct {
Recursive bool
}
type Option func(*Options)
func WithRecursive(bool value) Option {
return func(o *Options) {
o.Recursive = value
}
}
Get(ctx context.Context, path, branch string, optFns ...Option) ([]*CommitFile, error) And call it? Get(ctx, "./clusters/my-cluster", "main", gitprovider.WithRecursive(true)) I'm not soo familiar w/ this pattern so if you have a good idea what the interfaces could look like please feel free to scribble something else! |
On tackling:
|
The current implementation to
GET
a repository's content that was added in #80 does not get a directory tree recursively - it only returns a single, end subdirectory and its files. This is ok for now, but returning all directories recursively could be enabled easily by passing an option withRepositoryContentGetOptions
, specifically here.See documentation:
Alternatively, it would be nice to have the option to pass any
RepositoryContentGetOptions
:)The text was updated successfully, but these errors were encountered: