kubo
kubo copied to clipboard
feat(cmds/add): --to-files option as files cp
Closes https://github.com/ipfs/go-ipfs/issues/8504.
Sharness missing: https://github.com/ipfs/go-ipfs/issues/8504#issuecomment-1115031052
Example:
ipfs add p2p -r --to-files /
# added QmWSpN5PR7rkcnHQAWU8AvrAnqUtZnDfSzfFd9r5xnh7DJ p2p/listener.go
# added QmSj2YofPhB4i6LQwfBhdZZv5h7p1NNK8sTWYxT7xsKyUx p2p/local.go
# added QmaUuTcmN4y8G2E8i14U7VstZyrF6RrydbUanYkXt2hPXg p2p/p2p.go
# added QmTDkjKwN6ZxndDUnyLjdDF1yBxjr2TzBmmq2sDSgP82TE p2p/remote.go
# added QmQHnDfEdHDQPCksGNiY9asadBYMkmcQ5xKULog8FZLVJ3 p2p/stream.go
# added QmWw69M8XVQEV4tUQVYeUK9Er1v7M32X6Lz41Zg6ttzdnE p2p
ipfs files ls /p2p
# listener.go
# local.go
# p2p.go
# remote.go
# stream.go
I can't reproduce your error. Let's just wait on @lidel's review on this one.
I'm now hitting @Jorropo's error Error: expected a file argument
. Not sure if this is related to the rebase, but in any case I'll delve deeper into the add
command.
This fails when running it through the daemon, fixing.
It seems the iterator for multipartDirectory
somehow consumes the state of the directory from where it's derived and we can't call it twice:
https://github.com/ipfs/go-ipfs-files/blob/88b4692b4642719bb8459a966f4b9a3da57c6e2d/multipartfile.go#L218-L221
(I could try to repackage what was iterated but seems the cleaner approach is to fix this upstream.)
Blocked on https://github.com/ipfs/go-ipfs-files/issues/53.
We can't easily fix https://github.com/ipfs/go-ipfs-files/issues/53 so working around it here.
@lidel Unified loops to use the iterator only once.
@Jorropo I tested the exact same command as you did and it is working fine. Can you have another look, please? @lidel I see that there are some sharness tests. Do we need more of them?
2022-09-20 conversation: @lidel will check to see if more sharness tests are needed. If there are more tests needed, @lidel will specify them and @ajnavarro will do them. If there is sufficient coverage @lidel will merge.