提交 e4447b3c 作者: W. Trevor King

core/commands/publish: Fix published message

Previously we had a confusing situation, with:

* single-arg doc: published name <name> to <value>
* double-arg doc: published name <value> to <name>
* implementation: Published name <name> to <value>

Now we have the uniform:

  Published to <name>: <value>

With the following goals:

1. It's clear that we're writing <value> to <name>'s IPNS slot in the
   DHT.
2. We preserve the order of arguments from the command-line
   invocation:

     $ ipfs name publish <name> <value>
     Published to <name>: <value>
上级 416d454b
...@@ -27,15 +27,15 @@ and resolve, the default value of <name> is your own identity public key. ...@@ -27,15 +27,15 @@ and resolve, the default value of <name> is your own identity public key.
Examples: Examples:
Publish a <ref> to your identity name: Publish an <ipfs-path> to your identity name:
> ipfs name publish QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
Publish a <ref> to another public key: Publish an <ipfs-path> to another public key:
> ipfs name publish QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
Resolve the value of your identity: Resolve the value of your identity:
......
...@@ -35,12 +35,13 @@ Examples: ...@@ -35,12 +35,13 @@ Examples:
Publish an <ipfs-path> to your identity name: Publish an <ipfs-path> to your identity name:
> ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
Publish an <ipfs-path> to another public key (not implemented): Publish an <ipfs-path> to another public key (not implemented):
> ipfs name publish QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy > ipfs name publish /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
published name QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n to QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy Published to QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n: /ipfs/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
`, `,
}, },
...@@ -102,7 +103,7 @@ Publish an <ipfs-path> to another public key (not implemented): ...@@ -102,7 +103,7 @@ Publish an <ipfs-path> to another public key (not implemented):
Marshalers: cmds.MarshalerMap{ Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) (io.Reader, error) { cmds.Text: func(res cmds.Response) (io.Reader, error) {
v := res.Output().(*IpnsEntry) v := res.Output().(*IpnsEntry)
s := fmt.Sprintf("Published name %s to %s\n", v.Name, v.Value) s := fmt.Sprintf("Published to %s: %s\n", v.Name, v.Value)
return strings.NewReader(s), nil return strings.NewReader(s), nil
}, },
}, },
......
...@@ -14,11 +14,11 @@ test_init_ipfs ...@@ -14,11 +14,11 @@ test_init_ipfs
test_expect_success "'ipfs name publish' succeeds" ' test_expect_success "'ipfs name publish' succeeds" '
PEERID=`ipfs id --format="<id>"` && PEERID=`ipfs id --format="<id>"` &&
ipfs name publish "$HASH_WELCOME_DOCS" >publish_out ipfs name publish "/ipfs/$HASH_WELCOME_DOCS" >publish_out
' '
test_expect_success "publish output looks good" ' test_expect_success "publish output looks good" '
echo "Published name $PEERID to /ipfs/$HASH_WELCOME_DOCS" >expected1 && echo "Published to ${PEERID}: /ipfs/$HASH_WELCOME_DOCS" >expected1 &&
test_cmp publish_out expected1 test_cmp publish_out expected1
' '
...@@ -39,7 +39,7 @@ test_expect_success "'ipfs name publish' succeeds" ' ...@@ -39,7 +39,7 @@ test_expect_success "'ipfs name publish' succeeds" '
' '
test_expect_success "publish a path looks good" ' test_expect_success "publish a path looks good" '
echo "Published name $PEERID to /ipfs/$HASH_WELCOME_DOCS/help" >expected3 && echo "Published to ${PEERID}: /ipfs/$HASH_WELCOME_DOCS/help" >expected3 &&
test_cmp publish_out expected3 test_cmp publish_out expected3
' '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论