Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
57457af7
Commit
57457af7
authored
Jan 07, 2019
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change --output-cidv1 to --force-cid-base.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
8209ba61
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
core/commands/cmdenv/cidbase.go
core/commands/cmdenv/cidbase.go
+3
-3
core/commands/root.go
core/commands/root.go
+1
-1
test/sharness/t0051-object.sh
test/sharness/t0051-object.sh
+5
-5
No files found.
core/commands/cmdenv/cidbase.go
View file @
57457af7
...
...
@@ -10,7 +10,7 @@ import (
)
var
OptionCidBase
=
cmdkit
.
StringOption
(
"cid-base"
,
"Multibase encoding used for version 1 CIDs in output."
)
var
Option
OutputCidV1
=
cmdkit
.
BoolOption
(
"
output-cidv1"
,
"U
pgrad
e
CID
version 0 to version 1 in output
."
)
var
Option
ForceCidBase
=
cmdkit
.
BoolOption
(
"
force-cid-base"
,
"Force multibase prefix by u
pgrad
ing
CID
v0 to CIDv1
."
)
// GetCidEncoder processes the `cid-base` and `output-cidv1` options and
// returns a encoder to use based on those parameters.
...
...
@@ -26,8 +26,8 @@ func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error) {
}
func
getCidBase
(
req
*
cmds
.
Request
,
autoUpgrade
bool
)
(
cidenc
.
Encoder
,
error
)
{
base
,
_
:=
req
.
Options
[
"cid-base"
]
.
(
string
)
upgrade
,
upgradeDefined
:=
req
.
Options
[
"output-cidv1"
]
.
(
bool
)
base
,
_
:=
req
.
Options
[
OptionCidBase
.
Name
()
]
.
(
string
)
upgrade
,
upgradeDefined
:=
req
.
Options
[
OptionForceCidBase
.
Name
()
]
.
(
bool
)
e
:=
cidenc
.
Default
()
...
...
core/commands/root.go
View file @
57457af7
...
...
@@ -100,7 +100,7 @@ The CLI will exit with one of the following values:
// global options, added to every command
cmdenv
.
OptionCidBase
,
cmdenv
.
Option
OutputCidV1
,
cmdenv
.
Option
ForceCidBase
,
cmds
.
OptionEncodingType
,
cmds
.
OptionStreamChannels
,
...
...
test/sharness/t0051-object.sh
View file @
57457af7
...
...
@@ -363,11 +363,11 @@ test_object_cmd() {
test_cmp expected_putOut actual_putOut
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
output-cidv1
=true' succeeds"
'
ipfs object put --cid-base=base32 --
output-cidv1
=true ../t0051-object-data/testPut.json > actual_putOut
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
force-cid-base
=true' succeeds"
'
ipfs object put --cid-base=base32 --
force-cid-base
=true ../t0051-object-data/testPut.json > actual_putOut
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
output-cidv1
=true' output looks good"
'
test_expect_success
"'ipfs object put file.json --cid-base=base32 --
force-cid-base
=true' output looks good"
'
HASH=$(ipfs cid base32 "QmUTSAdDi2xsNkDtLqjFgQDMEn5di3Ab9eqbrt4gaiNbUD") &&
printf "added $HASH\n" > expected_putOut &&
test_cmp expected_putOut actual_putOut
...
...
@@ -394,8 +394,8 @@ test_object_cmd() {
grep -q $(ipfs cid base32 $HASHv1) mixed.actual
'
test_expect_success
"ipfs object links --cid-base=base32 --
output-cidv1
=true converts both links"
'
ipfs object links --cid-base=base32 --
output-cidv1
=true $MIXED | awk "{print \$1}" | sort > links.actual &&
test_expect_success
"ipfs object links --cid-base=base32 --
force-cid-base
=true converts both links"
'
ipfs object links --cid-base=base32 --
force-cid-base
=true $MIXED | awk "{print \$1}" | sort > links.actual &&
echo $(ipfs cid base32 $HASHv1) > links.expected
echo $(ipfs cid base32 $HASHv0) >> links.expected
test_cmp links.actual links.expected
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment