mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-21 11:44:16 +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(),
|
Hash: rp.Cid().String(),
|
||||||
Links: outLinks,
|
Links: outLinks,
|
||||||
}
|
}
|
||||||
@ -183,10 +183,10 @@ multihash.
|
|||||||
w := tabwriter.NewWriter(buf, 1, 2, 1, ' ', 0)
|
w := tabwriter.NewWriter(buf, 1, 2, 1, ' ', 0)
|
||||||
headers, _, _ := res.Request().Option("headers").Bool()
|
headers, _, _ := res.Request().Option("headers").Bool()
|
||||||
if headers {
|
if headers {
|
||||||
fmt.Fprintln(w, "Hash\tSize\tName\t")
|
fmt.Fprintln(w, "Hash\tSize\tName")
|
||||||
}
|
}
|
||||||
for _, link := range object.Links {
|
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()
|
w.Flush()
|
||||||
return buf, nil
|
return buf, nil
|
||||||
|
@ -223,6 +223,12 @@ test_object_cmd() {
|
|||||||
ipfs object stat $OUTPUT
|
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" '
|
test_expect_success "'ipfs object patch add-link' should work with paths" '
|
||||||
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
|
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
|
||||||
N1=$(ipfs object patch $EMPTY_DIR add-link baz $EMPTY_DIR) &&
|
N1=$(ipfs object patch $EMPTY_DIR add-link baz $EMPTY_DIR) &&
|
||||||
|
Reference in New Issue
Block a user