unix-friendly output for 'ipfs dht' commands
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
# Work Items
- [x] `ipfs dht findprovs`: lists the full peerIDs of providers, one per line (https://github.com/ipfs/go-ipfs/pull/2560)
- [x] `ipfs dht findpeer`: lists multiaddrs discovered for the given peer, one per line (https://github.com/ipfs/go-ipfs/pull/2560)
- [x] `ipfs dht get`: outputs the single best value selected for that key (https://github.com/ipfs/go-ipfs/pull/2560)
- [x] `ipfs dht query`: lists of closest peer IDs, one per line (https://github.com/ipfs/go-ipfs/pull/2560)
- [x] `ipfs dht put`: lists the peer IDs of the peers that it stored a record with (https://github.com/ipfs/go-ipfs/pull/2560)
- [x] more clearly document the helptext across all commands (https://github.com/ipfs/go-ipfs/pull/2560)
- [ ] output all verbose output to stderr
- [ ] provide a flag for 'ifps dht get' that lists all records (not just the best one)
# Summary
Today:
```
$ ipfs dht findprovs QmNmL1foPtvw25dWR41eeqW5YcLZJA5b3XoKrrBYUwKhnv
QmRc5iJERYKMjFsJ57jsxJhUjf86HL1WyqrQBTJrCCAnKN
* says use
* says use
```
Imagined output:
```
$ ipfs dht findprovs QmNmL1foPtvw25dWR41eeqW5YcLZJA5b3XoKrrBYUwKhnv
QmNh2nZ3tWc8hbAbGNmfQQN9TmPAkpwKztjH8xZvcrv3eF
QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx
QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z
...
```
Important properties:
1. no errors inlined into output (or, use stderr at least)
2. simple, newline-delimited output that is immediately usable for unix programs
This makes the commands much friendlier to unix scripts -- IDs can be grabbed and fed into e.g. `ipfs dht findpeer` more or less directly! We could still retain a `-s|--simple` option that gives short PeerIDs for existing compatibility, and keep `-v|--verbose` for detailed human output.
---
cc @whyrusleeping
Contributor guide
Assessment
This issue has not been assessed yet.