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 <nick@wabbo.org>
Nick Hamann committed
Nov 23, 2015 at 13:46 UTC
d49a15f566027227b31291326df71aa39906c6ed
8 files changed
+15
-15
core/commands/ipns.go
+1
-1
@@ -121,7 +121,7 @@ Resolve the value of another name:
121
if !ok {
122
return nil, u.ErrCast()
123
}
124
- return strings.NewReader(output.Path.String()), nil
124
+ return strings.NewReader(output.Path.String() + "\n"), nil
125
},
126
},
127
Type: ResolvedPath{},
core/commands/object.go
+1
-1
@@ -371,7 +371,7 @@ and then run
371
Marshalers: cmds.MarshalerMap{
372
cmds.Text: func(res cmds.Response) (io.Reader, error) {
373
object := res.Output().(*Object)
374
- return strings.NewReader("added " + object.Hash), nil
374
+ return strings.NewReader("added " + object.Hash + "\n"), nil
375
},
376
},
377
Type: Object{},
core/commands/resolve.go
+1
-1
@@ -117,7 +117,7 @@ Resolve the value of an IPFS DAG path:
117
if !ok {
118
return nil, u.ErrCast()
119
}
120
- return strings.NewReader(output.Path.String()), nil
120
+ return strings.NewReader(output.Path.String() + "\n"), nil
121
},
122
},
123
Type: ResolvedPath{},
core/commands/tar.go
+1
-1
@@ -67,7 +67,7 @@ var tarAddCmd = &cmds.Command{
67
Marshalers: cmds.MarshalerMap{
68
cmds.Text: func(res cmds.Response) (io.Reader, error) {
69
o := res.Output().(*AddedObject)
70
- return strings.NewReader(o.Hash), nil
70
+ return strings.NewReader(o.Hash + "\n"), nil
71
},
72
},
73
}
test/sharness/t0051-object.sh
+6
-6
@@ -66,7 +66,7 @@ test_object_cmd() {
66
67
test_expect_success "'ipfs object put file.json' output looks good" '
68
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
69
- printf "added $HASH" > expected_putOut &&
69
+ printf "added $HASH\n" > expected_putOut &&
70
test_cmp expected_putOut actual_putOut
71
'
72
@@ -76,7 +76,7 @@ test_object_cmd() {
76
77
test_expect_success "'ipfs object put file.xml' output looks good" '
78
HASH="QmQzNKUHy4HyEUGkqKe3q3t796ffPLQXYCkHCcXUNT5JNK" &&
79
- printf "added $HASH" > expected_putOut &&
79
+ printf "added $HASH\n" > expected_putOut &&
80
test_cmp expected_putOut actual_putOut
81
'
82
@@ -103,7 +103,7 @@ test_object_cmd() {
103
'
104
105
test_expect_failure "'ipfs object put --inputenc=xml' output looks good" '
106
- echo "added $HASH" >expected &&
106
+ echo "added $HASH\n" >expected &&
107
test_cmp expected actual
108
'
109
@@ -113,7 +113,7 @@ test_object_cmd() {
113
114
test_expect_success "'ipfs object put file.pb' output looks good" '
115
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
116
- printf "added $HASH" > expected_putOut &&
116
+ printf "added $HASH\n" > expected_putOut &&
117
test_cmp expected_putOut actual_putOut
118
'
119
@@ -123,7 +123,7 @@ test_object_cmd() {
123
124
test_expect_success "'ipfs object put' from stdin output looks good" '
125
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
126
- printf "added $HASH" > expected_putStdinOut &&
126
+ printf "added $HASH\n" > expected_putStdinOut &&
127
test_cmp expected_putStdinOut actual_putStdinOut
128
'
129
@@ -133,7 +133,7 @@ test_object_cmd() {
133
134
test_expect_success "'ipfs object put' from stdin (pb) output looks good" '
135
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
136
- printf "added $HASH" > expected_putStdinOut &&
136
+ printf "added $HASH\n" > expected_putStdinOut &&
137
test_cmp expected_putStdinOut actual_putPbStdinOut
138
'
139
test/sharness/t0100-name.sh
+2
-2
@@ -28,7 +28,7 @@ test_expect_success "'ipfs name resolve' succeeds" '
28
'
29
30
test_expect_success "resolve output looks good" '
31
- printf "/ipfs/%s" "$HASH_WELCOME_DOCS" >expected2 &&
31
+ printf "/ipfs/%s\n" "$HASH_WELCOME_DOCS" >expected2 &&
32
test_cmp expected2 output
33
'
34
@@ -50,7 +50,7 @@ test_expect_success "'ipfs name resolve' succeeds" '
50
'
51
52
test_expect_success "resolve output looks good" '
53
- printf "/ipfs/%s/help" "$HASH_WELCOME_DOCS" >expected4 &&
53
+ printf "/ipfs/%s/help\n" "$HASH_WELCOME_DOCS" >expected4 &&
54
test_cmp expected4 output
55
'
56
test/sharness/t0160-resolve.sh
+2
-2
@@ -20,7 +20,7 @@ test_resolve_setup_name() {
20
test_expect_success "resolve: prepare name" '
21
id_hash=$(ipfs id -f="<id>") &&
22
ipfs name publish "$ref" &&
23
- printf "$ref" >expected_nameval &&
23
+ printf "$ref\n" >expected_nameval &&
24
ipfs name resolve >actual_nameval &&
25
test_cmp expected_nameval actual_nameval
26
'
@@ -47,7 +47,7 @@ test_resolve() {
47
'
48
49
test_expect_success "resolved correctly: $src -> $dst" '
50
- printf "$dst" >expected &&
50
+ printf "$dst\n" >expected &&
51
test_cmp expected actual
52
'
53
}
test/sharness/t0240-republisher.sh
+1
-1
@@ -64,7 +64,7 @@ verify_can_resolve() {
64
'
65
66
test_expect_success "output looks right" '
67
- printf "/ipfs/$expected" > expected &&
67
+ printf "/ipfs/$expected\n" > expected &&
68
test_cmp expected resolve
69
'
70
}