-
Notifications
You must be signed in to change notification settings - Fork 44
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 list
and filter
commands
#227
Conversation
v2/cmd/car/list.go
Outdated
} | ||
return err | ||
} | ||
outStream.WriteString(fmt.Sprintf("%s\n", blk.Cid())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outStream.WriteString(fmt.Sprintf("%s\n", blk.Cid())) | |
fmt.Fprintf(outStream, "%s\n", blk.Cid()) |
v2/cmd/car/list.go
Outdated
} | ||
defer outStream.Close() | ||
|
||
rd, err := icarv1.NewCarReader(r.DataReader()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use https://pkg.go.dev/github.com/ipld/go-car/v2@master#BlockReader? it was written precisely for this :) and it even supports both carv1 and carv2.
v2/cmd/car/filter.go
Outdated
} | ||
fmt.Printf("filtering to %d cids\n", len(cidList)) | ||
|
||
cidMap := make(map[cid.Cid]struct{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider making parseCIDs build a map directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also I wonder if you should at least print a warning on duplicate CIDs
example usage: