mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-20 02:21:48 +08:00
Merge pull request #5459 from ipfs/fix/5458
fix output of object command
This commit is contained in:
@ -160,7 +160,7 @@ multihash.
|
||||
}
|
||||
}
|
||||
|
||||
out := Object{
|
||||
out := &Object{
|
||||
Hash: rp.Cid().String(),
|
||||
Links: outLinks,
|
||||
}
|
||||
@ -183,10 +183,10 @@ multihash.
|
||||
w := tabwriter.NewWriter(buf, 1, 2, 1, ' ', 0)
|
||||
headers, _, _ := res.Request().Option("headers").Bool()
|
||||
if headers {
|
||||
fmt.Fprintln(w, "Hash\tSize\tName\t")
|
||||
fmt.Fprintln(w, "Hash\tSize\tName")
|
||||
}
|
||||
for _, link := range object.Links {
|
||||
fmt.Fprintf(w, "%s\t%v\t%s\t\n", link.Hash, link.Size, link.Name)
|
||||
fmt.Fprintf(w, "%s\t%v\t%s\n", link.Hash, link.Size, link.Name)
|
||||
}
|
||||
w.Flush()
|
||||
return buf, nil
|
||||
|
@ -223,6 +223,12 @@ test_object_cmd() {
|
||||
ipfs object stat $OUTPUT
|
||||
'
|
||||
|
||||
test_expect_success "'ipfs object links' gives the correct results" '
|
||||
echo "$EMPTY_DIR" 4 foo > expected &&
|
||||
ipfs object links "$OUTPUT" > actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success "'ipfs object patch add-link' should work with paths" '
|
||||
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
|
||||
N1=$(ipfs object patch $EMPTY_DIR add-link baz $EMPTY_DIR) &&
|
||||
|
Reference in New Issue
Block a user