@cryptotaxi247 / kubo / commits / b7ea4bfc2

modify command name and update the test

License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com>

Kejie Zhang committed Sep 12, 2018 at 05:55 UTC b7ea4bfc2a2c3b864d688c108245a3429029e185
2 files changed +9 -9
core/commands/add.go
+3 -3
@@ -37,7 +37,7 @@ const (
37 progressOptionName = "progress"
38 trickleOptionName = "trickle"
39 wrapOptionName = "wrap-with-directory"
40 - pathName = "name"
40 + stdinPathName = "stdin-name"
41 hiddenOptionName = "hidden"
42 onlyHashOptionName = "only-hash"
43 chunkerOptionName = "chunker"
@@ -117,7 +117,7 @@ You can now check what blocks have been created by:
117 cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
118 cmdkit.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."),
119 cmdkit.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
120 - cmdkit.StringOption(pathName, "Assign a name if the file source is stdin."),
120 + cmdkit.StringOption(stdinPathName, "Assign a name if the file source is stdin."),
121 cmdkit.BoolOption(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."),
122 cmdkit.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"),
123 cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
@@ -183,7 +183,7 @@ You can now check what blocks have been created by:
183 hashFunStr, _ := req.Options[hashOptionName].(string)
184 inline, _ := req.Options[inlineOptionName].(bool)
185 inlineLimit, _ := req.Options[inlineLimitOptionName].(int)
186 - pathName, _ := req.Options[pathName].(string)
186 + pathName, _ := req.Options[stdinPathName].(string)
187
188 // The arguments are subject to the following constraints.
189 //
test/sharness/t0040-add-and-cat.sh
+6 -6
@@ -185,22 +185,22 @@ test_add_cat_file() {
185 test_cmp zero-length-file zero-length-file_out
186 '
187
188 - test_expect_success "ipfs add --name" '
188 + test_expect_success "ipfs add --stdin-name" '
189 NAMEHASH="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
190 - echo "IPFS" | ipfs add --name file.txt > actual &&
190 + echo "IPFS" | ipfs add --stdin-name file.txt > actual &&
191 echo "added $NAMEHASH file.txt" > expected &&
192 test_cmp expected actual
193 '
194
195 - test_expect_success "ipfs add --name -w" '
195 + test_expect_success "ipfs add --stdin-name -w" '
196 NAMEHASH="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
197 - echo "IPFS" | ipfs add -w --name file.txt | head -n1> actual &&
197 + echo "IPFS" | ipfs add -w --stdin-name file.txt | head -n1> actual &&
198 echo "added $NAMEHASH file.txt" > expected &&
199 test_cmp expected actual
200 '
201
202 - test_expect_success "ipfs cat with name" '
203 - NAMEHASH=$(echo "IPFS" | ipfs add -w --name file.txt -Q) &&
202 + test_expect_success "ipfs cat with stdin-name" '
203 + NAMEHASH=$(echo "IPFS" | ipfs add -w --stdin-name file.txt -Q) &&
204 ipfs cat /ipfs/$NAMEHASH/file.txt > expected &&
205 echo "IPFS" > actual &&
206 test_cmp expected actual