File tree 4 files changed +14
-14
lines changed
4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import (
11
11
)
12
12
13
13
var OptionCidBase = cmdkit .StringOption ("cid-base" , "Multibase encoding used for version 1 CIDs in output." )
14
- var OptionForceCidBase = cmdkit .BoolOption ("force-cid-base " , "Force multibase prefix by upgrading CIDv0 to CIDv1 ." )
14
+ var OptionUpgradeCidV0InOutput = cmdkit .BoolOption ("upgrade-cidv0-in-output " , "Upgrade version 0 to version 1 CIDs in output ." )
15
15
16
16
// GetCidEncoder processes the `cid-base` and `output-cidv1` options and
17
17
// returns a encoder to use based on those parameters.
@@ -28,7 +28,7 @@ func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error) {
28
28
29
29
func getCidBase (req * cmds.Request , autoUpgrade bool ) (cidenc.Encoder , error ) {
30
30
base , _ := req .Options [OptionCidBase .Name ()].(string )
31
- upgrade , upgradeDefined := req .Options [OptionForceCidBase .Name ()].(bool )
31
+ upgrade , upgradeDefined := req .Options [OptionUpgradeCidV0InOutput .Name ()].(bool )
32
32
33
33
e := cidenc .Default ()
34
34
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ The CLI will exit with one of the following values:
100
100
101
101
// global options, added to every command
102
102
cmdenv .OptionCidBase ,
103
- cmdenv .OptionForceCidBase ,
103
+ cmdenv .OptionUpgradeCidV0InOutput ,
104
104
105
105
cmds .OptionEncodingType ,
106
106
cmds .OptionStreamChannels ,
Original file line number Diff line number Diff line change @@ -292,20 +292,20 @@ test_add_cat_file() {
292
292
test_cmp expected oh_actual
293
293
'
294
294
295
- test_expect_success " ipfs add --cid-base=base32 --force-cid-base =false succeeds" '
295
+ test_expect_success " ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false succeeds" '
296
296
echo "base32 test" >mountdir/base32-test.txt &&
297
- ipfs add --cid-base=base32 --force-cid-base =false mountdir/base32-test.txt >actual
297
+ ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false mountdir/base32-test.txt >actual
298
298
'
299
- test_expect_success " ipfs add --cid-base=base32 --force-cid-base =false output looks good" '
299
+ test_expect_success " ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false output looks good" '
300
300
HASHv0=$(cid-fmt -v 0 -b z %s "$HASHb32") &&
301
301
echo "added $HASHv0 base32-test.txt" >expected &&
302
302
test_cmp expected actual
303
303
'
304
304
305
- test_expect_success " ipfs add --cid-base=base32 --force-cid-base =false --only-hash succeeds" '
306
- ipfs add --cid-base=base32 --force-cid-base =false --only-hash mountdir/base32-test.txt > oh_actual
305
+ test_expect_success " ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false --only-hash succeeds" '
306
+ ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false --only-hash mountdir/base32-test.txt > oh_actual
307
307
'
308
- test_expect_success " ipfs add --cid-base=base32 --force-cid-base =false --only-hash output looks good" '
308
+ test_expect_success " ipfs add --cid-base=base32 --upgrade-cidv0-in-output =false --only-hash output looks good" '
309
309
test_cmp expected oh_actual
310
310
'
311
311
Original file line number Diff line number Diff line change @@ -363,11 +363,11 @@ test_object_cmd() {
363
363
test_cmp expected_putOut actual_putOut
364
364
'
365
365
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
366
+ test_expect_success " 'ipfs object put file.json --cid-base=base32 --upgrade-cidv0-in-output =true' succeeds" '
367
+ ipfs object put --cid-base=base32 --upgrade-cidv0-in-output =true ../t0051-object-data/testPut.json > actual_putOut
368
368
'
369
369
370
- test_expect_success " 'ipfs object put file.json --cid-base=base32 --force-cid-base =true' output looks good" '
370
+ test_expect_success " 'ipfs object put file.json --cid-base=base32 --upgrade-cidv0-in-output =true' output looks good" '
371
371
HASH=$(ipfs cid base32 "QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD") &&
372
372
printf "added $HASH\n" > expected_putOut &&
373
373
test_cmp expected_putOut actual_putOut
@@ -394,8 +394,8 @@ test_object_cmd() {
394
394
grep -q $(ipfs cid base32 $HASHv1) mixed.actual
395
395
'
396
396
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 &&
397
+ test_expect_success " ipfs object links --cid-base=base32 --upgrade-cidv0-in-output =true converts both links" '
398
+ ipfs object links --cid-base=base32 --upgrade-cidv0-in-output =true $MIXED | awk "{print \$1}" | sort > links.actual &&
399
399
echo $(ipfs cid base32 $HASHv1) > links.expected
400
400
echo $(ipfs cid base32 $HASHv0) >> links.expected
401
401
test_cmp links.actual links.expected
You can’t perform that action at this time.
0 commit comments