Change --output-cidv1 to --force-cid-base.
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
Kevin Atkinson committed
Jan 7, 2019 at 16:43 UTC
57457af7d28669c39e906b067a1967eb0e2f46fa
3 files changed
+9
-9
core/commands/cmdenv/cidbase.go
+3
-3
@@ -10,7 +10,7 @@ import (
10
)
11
12
var OptionCidBase = cmdkit.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
13
-var OptionOutputCidV1 = cmdkit.BoolOption("output-cidv1", "Upgrade CID version 0 to version 1 in output.")
13
+var OptionForceCidBase = cmdkit.BoolOption("force-cid-base", "Force multibase prefix by upgrading CIDv0 to CIDv1.")
14
15
// GetCidEncoder processes the `cid-base` and `output-cidv1` options and
16
// returns a encoder to use based on those parameters.
@@ -26,8 +26,8 @@ func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error) {
26
}
27
28
func getCidBase(req *cmds.Request, autoUpgrade bool) (cidenc.Encoder, error) {
29
- base, _ := req.Options["cid-base"].(string)
30
- upgrade, upgradeDefined := req.Options["output-cidv1"].(bool)
29
+ base, _ := req.Options[OptionCidBase.Name()].(string)
30
+ upgrade, upgradeDefined := req.Options[OptionForceCidBase.Name()].(bool)
31
32
e := cidenc.Default()
33
core/commands/root.go
+1
-1
@@ -100,7 +100,7 @@ The CLI will exit with one of the following values:
100
101
// global options, added to every command
102
cmdenv.OptionCidBase,
103
- cmdenv.OptionOutputCidV1,
103
+ cmdenv.OptionForceCidBase,
104
105
cmds.OptionEncodingType,
106
cmds.OptionStreamChannels,
test/sharness/t0051-object.sh
+5
-5
@@ -363,11 +363,11 @@ test_object_cmd() {
363
test_cmp expected_putOut actual_putOut
364
'
365
366
- test_expect_success "'ipfs object put file.json --cid-base=base32 --output-cidv1=true' succeeds" '
367
- ipfs object put --cid-base=base32 --output-cidv1=true ../t0051-object-data/testPut.json > actual_putOut
366
+ test_expect_success "'ipfs object put file.json --cid-base=base32 --force-cid-base=true' succeeds" '
367
+ ipfs object put --cid-base=base32 --force-cid-base=true ../t0051-object-data/testPut.json > actual_putOut
368
'
369
370
- test_expect_success "'ipfs object put file.json --cid-base=base32 --output-cidv1=true' output looks good" '
370
+ test_expect_success "'ipfs object put file.json --cid-base=base32 --force-cid-base=true' output looks good" '
371
HASH=$(ipfs cid base32 "QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD") &&
372
printf "added $HASH\n" > expected_putOut &&
373
test_cmp expected_putOut actual_putOut
@@ -394,8 +394,8 @@ test_object_cmd() {
394
grep -q $(ipfs cid base32 $HASHv1) mixed.actual
395
'
396
397
- test_expect_success "ipfs object links --cid-base=base32 --output-cidv1=true converts both links" '
398
- ipfs object links --cid-base=base32 --output-cidv1=true $MIXED | awk "{print \$1}" | sort > links.actual &&
397
+ test_expect_success "ipfs object links --cid-base=base32 --force-cid-base=true converts both links" '
398
+ ipfs object links --cid-base=base32 --force-cid-base=true $MIXED | awk "{print \$1}" | sort > links.actual &&
399
echo $(ipfs cid base32 $HASHv1) > links.expected
400
echo $(ipfs cid base32 $HASHv0) >> links.expected
401
test_cmp links.actual links.expected