From 8a61b536daa413c444bebb8d9173f1caa80c1644 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Mon, 23 Nov 2015 13:46:49 -0600 Subject: [PATCH] Add newline to end of the output for a few commands. Commands affected: - ipfs object put - ipfs tar add - ipfs resolve - ipfs name resolve License: MIT Signed-off-by: Nick Hamann More --- core/commands/ipns.go | 2 +- core/commands/object.go | 2 +- core/commands/resolve.go | 2 +- core/commands/tar.go | 2 +- test/sharness/t0051-object.sh | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/commands/ipns.go b/core/commands/ipns.go index 59128691402f..a1ca1417b452 100644 --- a/core/commands/ipns.go +++ b/core/commands/ipns.go @@ -121,7 +121,7 @@ Resolve the value of another name: if !ok { return nil, u.ErrCast() } - return strings.NewReader(output.Path.String()), nil + return strings.NewReader(output.Path.String() + "\n"), nil }, }, Type: ResolvedPath{}, diff --git a/core/commands/object.go b/core/commands/object.go index 2b6a1494ef1a..e2e8b3167a2b 100644 --- a/core/commands/object.go +++ b/core/commands/object.go @@ -371,7 +371,7 @@ and then run Marshalers: cmds.MarshalerMap{ cmds.Text: func(res cmds.Response) (io.Reader, error) { object := res.Output().(*Object) - return strings.NewReader("added " + object.Hash), nil + return strings.NewReader("added " + object.Hash + "\n"), nil }, }, Type: Object{}, diff --git a/core/commands/resolve.go b/core/commands/resolve.go index f6ad91eae339..9eaa590dff05 100644 --- a/core/commands/resolve.go +++ b/core/commands/resolve.go @@ -117,7 +117,7 @@ Resolve the value of an IPFS DAG path: if !ok { return nil, u.ErrCast() } - return strings.NewReader(output.Path.String()), nil + return strings.NewReader(output.Path.String() + "\n"), nil }, }, Type: ResolvedPath{}, diff --git a/core/commands/tar.go b/core/commands/tar.go index 0d6fc1318fab..7b84ac5f1f48 100644 --- a/core/commands/tar.go +++ b/core/commands/tar.go @@ -67,7 +67,7 @@ var tarAddCmd = &cmds.Command{ Marshalers: cmds.MarshalerMap{ cmds.Text: func(res cmds.Response) (io.Reader, error) { o := res.Output().(*AddedObject) - return strings.NewReader(o.Hash), nil + return strings.NewReader(o.Hash + "\n"), nil }, }, } diff --git a/test/sharness/t0051-object.sh b/test/sharness/t0051-object.sh index cc612addd2f6..ec97e39a285c 100755 --- a/test/sharness/t0051-object.sh +++ b/test/sharness/t0051-object.sh @@ -66,7 +66,7 @@ test_object_cmd() { test_expect_success "'ipfs object put file.json' output looks good" ' HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" && - printf "added $HASH" > expected_putOut && + printf "added $HASH\n" > expected_putOut && test_cmp expected_putOut actual_putOut ' @@ -76,7 +76,7 @@ test_object_cmd() { test_expect_success "'ipfs object put file.xml' output looks good" ' HASH="QmQzNKUHy4HyEUGkqKe3q3t796ffPLQXYCkHCcXUNT5JNK" && - printf "added $HASH" > expected_putOut && + printf "added $HASH\n" > expected_putOut && test_cmp expected_putOut actual_putOut ' @@ -103,7 +103,7 @@ test_object_cmd() { ' test_expect_failure "'ipfs object put --inputenc=xml' output looks good" ' - echo "added $HASH" >expected && + echo "added $HASH\n" >expected && test_cmp expected actual ' @@ -113,7 +113,7 @@ test_object_cmd() { test_expect_success "'ipfs object put file.pb' output looks good" ' HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" && - printf "added $HASH" > expected_putOut && + printf "added $HASH\n" > expected_putOut && test_cmp expected_putOut actual_putOut ' @@ -123,7 +123,7 @@ test_object_cmd() { test_expect_success "'ipfs object put' from stdin output looks good" ' HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" && - printf "added $HASH" > expected_putStdinOut && + printf "added $HASH\n" > expected_putStdinOut && test_cmp expected_putStdinOut actual_putStdinOut ' @@ -133,7 +133,7 @@ test_object_cmd() { test_expect_success "'ipfs object put' from stdin (pb) output looks good" ' HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" && - printf "added $HASH" > expected_putStdinOut && + printf "added $HASH\n" > expected_putStdinOut && test_cmp expected_putStdinOut actual_putPbStdinOut '