Skip to content

Commit

Permalink
remove dag put option shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Sep 27, 2021
1 parent 2920679 commit b83651b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ into an object of the specified format.
cmds.FileArg("object data", true, true, "The object to put").EnableStdin(),
},
Options: []cmds.Option{
cmds.StringOption("store-codec", "s", "Codec that the stored object will be encoded with").WithDefault("dag-cbor"),
cmds.StringOption("input-codec", "i", "Codec that the input object is encoded in").WithDefault("dag-json"),
cmds.StringOption("store-codec", "Codec that the stored object will be encoded with").WithDefault("dag-cbor"),
cmds.StringOption("input-codec", "Codec that the input object is encoded in").WithDefault("dag-json"),
cmds.BoolOption("pin", "Pin this object when adding."),
cmds.StringOption("hash", "Hash function to use").WithDefault("sha2-256"),
},
Expand Down
28 changes: 14 additions & 14 deletions test/sharness/t0053-dag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_dag_cmd() {
'

test_expect_success "can add an ipld object using dag-json to dag-json" '
IPLDHASH=$(cat ipld_object | ipfs dag put -i dag-json -s dag-json)
IPLDHASH=$(cat ipld_object | ipfs dag put --input-codec dag-json --store-codec dag-json)
'

test_expect_success "CID looks correct" '
Expand All @@ -54,7 +54,7 @@ test_dag_cmd() {
'

test_expect_success "can add an ipld object using dag-json to dag-cbor" '
IPLDHASH=$(cat ipld_object | ipfs dag put -i dag-json -s dag-cbor)
IPLDHASH=$(cat ipld_object | ipfs dag put --input-codec dag-json --store-codec dag-cbor)
'

test_expect_success "CID looks correct" '
Expand All @@ -75,7 +75,7 @@ test_dag_cmd() {
# (1) dag-cbor input

test_expect_success "can add a dag-cbor input block stored as dag-cbor" '
IPLDCBORHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-cbor)
IPLDCBORHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-cbor)
'

test_expect_success "dag-cbor CID looks correct" '
Expand All @@ -84,7 +84,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-cbor input block stored as dag-pb" '
IPLDPBHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-pb)
IPLDPBHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-pb)
'

test_expect_success "dag-pb CID looks correct" '
Expand All @@ -93,7 +93,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-cbor input block stored as dag-json" '
IPLDJSONHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-json)
IPLDJSONHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-json)
'

test_expect_success "dag-json CID looks correct" '
Expand All @@ -104,7 +104,7 @@ test_dag_cmd() {
# (2) dag-json input

test_expect_success "can add a dag-json input block stored as dag-cbor" '
IPLDCBORHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-cbor)
IPLDCBORHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-cbor)
'

test_expect_success "dag-cbor CID looks correct" '
Expand All @@ -113,7 +113,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-json input block stored as dag-pb" '
IPLDPBHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-pb)
IPLDPBHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-pb)
'

test_expect_success "dag-pb CID looks correct" '
Expand All @@ -122,7 +122,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-json input block stored as dag-json" '
IPLDJSONHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-json)
IPLDJSONHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-json)
'

test_expect_success "dag-json CID looks correct" '
Expand All @@ -133,7 +133,7 @@ test_dag_cmd() {
# (3) dag-pb input

test_expect_success "can add a dag-pb input block stored as dag-cbor" '
IPLDCBORHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-cbor)
IPLDCBORHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-cbor)
'

test_expect_success "dag-cbor CID looks correct" '
Expand All @@ -142,7 +142,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-pb input block stored as dag-pb" '
IPLDPBHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-pb)
IPLDPBHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-pb)
'

test_expect_success "dag-pb CID looks correct" '
Expand All @@ -151,7 +151,7 @@ test_dag_cmd() {
'

test_expect_success "can add a dag-pb input block stored as dag-json" '
IPLDJSONHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-json)
IPLDJSONHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-json)
'

test_expect_success "dag-json CID looks correct" '
Expand Down Expand Up @@ -245,7 +245,7 @@ test_dag_cmd() {
'

test_expect_success "retrieved object hashes back correctly" '
IPLDHASH2=$(cat ipld_obj_out | ipfs dag put -i dag-json -s dag-cbor) &&
IPLDHASH2=$(cat ipld_obj_out | ipfs dag put --input-codec dag-json --store-codec dag-cbor) &&
test "$IPLDHASH" = "$IPLDHASH2"
'

Expand All @@ -272,7 +272,7 @@ test_dag_cmd() {
'

test_expect_success "non-canonical dag-cbor input is normalized" '
HASH=$(cat ../t0053-dag-data/non-canon.cbor | ipfs dag put -s dag-cbor -i dag-cbor) &&
HASH=$(cat ../t0053-dag-data/non-canon.cbor | ipfs dag put --store-codec dag-cbor --input-codec dag-cbor) &&
test $HASH = "bafyreiawx7ona7oa2ptcoh6vwq4q6bmd7x2ibtkykld327bgb7t73ayrqm" ||
test_fsh echo $HASH
'
Expand All @@ -283,7 +283,7 @@ test_dag_cmd() {
'

test_expect_success "add an ipld with pin" '
PINHASH=$(printf {\"foo\":\"bar\"} | ipfs dag put -i dag-json --pin=true)
PINHASH=$(printf {\"foo\":\"bar\"} | ipfs dag put --input-codec dag-json --pin=true)
'

test_expect_success "after gc, objects still accessible" '
Expand Down
4 changes: 2 additions & 2 deletions test/sharness/t0055-dag-put-json-new-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ test_expect_success 'create test JSON files' '
'

test_expect_success 'puts as CBOR work' '
GOT_HASH_WITHOUT_NEWLINE="$(cat without_newline.json | ipfs dag put -s dag-cbor)"
GOT_HASH_WITH_NEWLINE="$(cat with_newline.json | ipfs dag put -s dag-cbor)"
GOT_HASH_WITHOUT_NEWLINE="$(cat without_newline.json | ipfs dag put --store-codec dag-cbor)"
GOT_HASH_WITH_NEWLINE="$(cat with_newline.json | ipfs dag put --store-codec dag-cbor)"
'

test_expect_success 'put hashes with or without newline are equal' '
Expand Down

0 comments on commit b83651b

Please sign in to comment.