diff --git a/core/commands/dag/dag.go b/core/commands/dag/dag.go index e3b2d202942..aa332c43ddd 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -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"), }, diff --git a/test/sharness/t0053-dag.sh b/test/sharness/t0053-dag.sh index 9f001a01ff3..4f10fd0c428 100755 --- a/test/sharness/t0053-dag.sh +++ b/test/sharness/t0053-dag.sh @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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" ' @@ -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 ' @@ -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" ' diff --git a/test/sharness/t0055-dag-put-json-new-line.sh b/test/sharness/t0055-dag-put-json-new-line.sh index 74f3badb313..1fde33ab61d 100755 --- a/test/sharness/t0055-dag-put-json-new-line.sh +++ b/test/sharness/t0055-dag-put-json-new-line.sh @@ -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' '