Skip to content

Commit

Permalink
Merge pull request #5459 from ipfs/fix/5458
Browse files Browse the repository at this point in the history
fix output of object command
  • Loading branch information
Stebalien authored Sep 13, 2018
2 parents cf96372 + 5629b1c commit cb589a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands/object/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ multihash.
}
}

out := Object{
out := &Object{
Hash: rp.Cid().String(),
Links: outLinks,
}
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/sharness/t0051-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down

0 comments on commit cb589a3

Please sign in to comment.