mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
Merge pull request #2000 from nham/object_put_newline
Add newline to end of `ipfs object put` text output.
This commit is contained in:
@ -121,7 +121,7 @@ Resolve the value of another name:
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, u.ErrCast()
|
return nil, u.ErrCast()
|
||||||
}
|
}
|
||||||
return strings.NewReader(output.Path.String()), nil
|
return strings.NewReader(output.Path.String() + "\n"), nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Type: ResolvedPath{},
|
Type: ResolvedPath{},
|
||||||
|
@ -371,7 +371,7 @@ and then run
|
|||||||
Marshalers: cmds.MarshalerMap{
|
Marshalers: cmds.MarshalerMap{
|
||||||
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
||||||
object := res.Output().(*Object)
|
object := res.Output().(*Object)
|
||||||
return strings.NewReader("added " + object.Hash), nil
|
return strings.NewReader("added " + object.Hash + "\n"), nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Type: Object{},
|
Type: Object{},
|
||||||
|
@ -117,7 +117,7 @@ Resolve the value of an IPFS DAG path:
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, u.ErrCast()
|
return nil, u.ErrCast()
|
||||||
}
|
}
|
||||||
return strings.NewReader(output.Path.String()), nil
|
return strings.NewReader(output.Path.String() + "\n"), nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Type: ResolvedPath{},
|
Type: ResolvedPath{},
|
||||||
|
@ -67,7 +67,7 @@ var tarAddCmd = &cmds.Command{
|
|||||||
Marshalers: cmds.MarshalerMap{
|
Marshalers: cmds.MarshalerMap{
|
||||||
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
||||||
o := res.Output().(*AddedObject)
|
o := res.Output().(*AddedObject)
|
||||||
return strings.NewReader(o.Hash), nil
|
return strings.NewReader(o.Hash + "\n"), nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ test_object_cmd() {
|
|||||||
|
|
||||||
test_expect_success "'ipfs object put file.json' output looks good" '
|
test_expect_success "'ipfs object put file.json' output looks good" '
|
||||||
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
||||||
printf "added $HASH" > expected_putOut &&
|
printf "added $HASH\n" > expected_putOut &&
|
||||||
test_cmp expected_putOut actual_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" '
|
test_expect_success "'ipfs object put file.xml' output looks good" '
|
||||||
HASH="QmQzNKUHy4HyEUGkqKe3q3t796ffPLQXYCkHCcXUNT5JNK" &&
|
HASH="QmQzNKUHy4HyEUGkqKe3q3t796ffPLQXYCkHCcXUNT5JNK" &&
|
||||||
printf "added $HASH" > expected_putOut &&
|
printf "added $HASH\n" > expected_putOut &&
|
||||||
test_cmp expected_putOut actual_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" '
|
test_expect_failure "'ipfs object put --inputenc=xml' output looks good" '
|
||||||
echo "added $HASH" >expected &&
|
echo "added $HASH\n" >expected &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ test_object_cmd() {
|
|||||||
|
|
||||||
test_expect_success "'ipfs object put file.pb' output looks good" '
|
test_expect_success "'ipfs object put file.pb' output looks good" '
|
||||||
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
||||||
printf "added $HASH" > expected_putOut &&
|
printf "added $HASH\n" > expected_putOut &&
|
||||||
test_cmp expected_putOut actual_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" '
|
test_expect_success "'ipfs object put' from stdin output looks good" '
|
||||||
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
||||||
printf "added $HASH" > expected_putStdinOut &&
|
printf "added $HASH\n" > expected_putStdinOut &&
|
||||||
test_cmp expected_putStdinOut actual_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" '
|
test_expect_success "'ipfs object put' from stdin (pb) output looks good" '
|
||||||
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
HASH="QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD" &&
|
||||||
printf "added $HASH" > expected_putStdinOut &&
|
printf "added $HASH\n" > expected_putStdinOut &&
|
||||||
test_cmp expected_putStdinOut actual_putPbStdinOut
|
test_cmp expected_putStdinOut actual_putPbStdinOut
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ test_expect_success "'ipfs name resolve' succeeds" '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "resolve output looks good" '
|
test_expect_success "resolve output looks good" '
|
||||||
printf "/ipfs/%s" "$HASH_WELCOME_DOCS" >expected2 &&
|
printf "/ipfs/%s\n" "$HASH_WELCOME_DOCS" >expected2 &&
|
||||||
test_cmp expected2 output
|
test_cmp expected2 output
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ test_expect_success "'ipfs name resolve' succeeds" '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "resolve output looks good" '
|
test_expect_success "resolve output looks good" '
|
||||||
printf "/ipfs/%s/help" "$HASH_WELCOME_DOCS" >expected4 &&
|
printf "/ipfs/%s/help\n" "$HASH_WELCOME_DOCS" >expected4 &&
|
||||||
test_cmp expected4 output
|
test_cmp expected4 output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ test_resolve_setup_name() {
|
|||||||
test_expect_success "resolve: prepare name" '
|
test_expect_success "resolve: prepare name" '
|
||||||
id_hash=$(ipfs id -f="<id>") &&
|
id_hash=$(ipfs id -f="<id>") &&
|
||||||
ipfs name publish "$ref" &&
|
ipfs name publish "$ref" &&
|
||||||
printf "$ref" >expected_nameval &&
|
printf "$ref\n" >expected_nameval &&
|
||||||
ipfs name resolve >actual_nameval &&
|
ipfs name resolve >actual_nameval &&
|
||||||
test_cmp expected_nameval actual_nameval
|
test_cmp expected_nameval actual_nameval
|
||||||
'
|
'
|
||||||
@ -47,7 +47,7 @@ test_resolve() {
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "resolved correctly: $src -> $dst" '
|
test_expect_success "resolved correctly: $src -> $dst" '
|
||||||
printf "$dst" >expected &&
|
printf "$dst\n" >expected &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ verify_can_resolve() {
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "output looks right" '
|
test_expect_success "output looks right" '
|
||||||
printf "/ipfs/$expected" > expected &&
|
printf "/ipfs/$expected\n" > expected &&
|
||||||
test_cmp expected resolve
|
test_cmp expected resolve
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user