Commit d93b9f11 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi ls: merge ResolveType and ResolveSize

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent a62acc82
......@@ -43,8 +43,7 @@ type UnixfsAddSettings struct {
}
type UnixfsLsSettings struct {
ResolveType bool
ResolveSize bool
ResolveChildren bool
}
type UnixfsAddOption func(*UnixfsAddSettings) error
......@@ -130,8 +129,7 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) {
options := &UnixfsLsSettings{
ResolveSize: true,
ResolveType: true,
ResolveChildren: true,
}
for _, opt := range opts {
......@@ -313,16 +311,9 @@ func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption {
}
}
func (unixfsOpts) ResolveSize(resolve bool) UnixfsLsOption {
func (unixfsOpts) ResolveChildren(resolve bool) UnixfsLsOption {
return func(settings *UnixfsLsSettings) error {
settings.ResolveSize = resolve
return nil
}
}
func (unixfsOpts) ResolveType(resolve bool) UnixfsLsOption {
return func(settings *UnixfsLsSettings) error {
settings.ResolveType = resolve
settings.ResolveChildren = resolve
return nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment