@cryptotaxi247 / kubo / commits / 9685afcf3

remove dag put option shortcuts

(cherry picked from commit b83651b22061d682e6fc9c83acf5f4639419c377)

Adin Schmahmann committed Sep 27, 2021 at 14:23 UTC 9685afcf3270e45a562d4fefb9225f61f38fd8e6
3 files changed +18 -18
core/commands/dag/dag.go
+2 -2
@@ -84,8 +84,8 @@ into an object of the specified format.
84 cmds.FileArg("object data", true, true, "The object to put").EnableStdin(),
85 },
86 Options: []cmds.Option{
87 - cmds.StringOption("store-codec", "s", "Codec that the stored object will be encoded with").WithDefault("dag-cbor"),
88 - cmds.StringOption("input-codec", "i", "Codec that the input object is encoded in").WithDefault("dag-json"),
87 + cmds.StringOption("store-codec", "Codec that the stored object will be encoded with").WithDefault("dag-cbor"),
88 + cmds.StringOption("input-codec", "Codec that the input object is encoded in").WithDefault("dag-json"),
89 cmds.BoolOption("pin", "Pin this object when adding."),
90 cmds.StringOption("hash", "Hash function to use").WithDefault("sha2-256"),
91 },
test/sharness/t0053-dag.sh
+14 -14
@@ -45,7 +45,7 @@ test_dag_cmd() {
45 '
46
47 test_expect_success "can add an ipld object using dag-json to dag-json" '
48 - IPLDHASH=$(cat ipld_object | ipfs dag put -i dag-json -s dag-json)
48 + IPLDHASH=$(cat ipld_object | ipfs dag put --input-codec dag-json --store-codec dag-json)
49 '
50
51 test_expect_success "CID looks correct" '
@@ -54,7 +54,7 @@ test_dag_cmd() {
54 '
55
56 test_expect_success "can add an ipld object using dag-json to dag-cbor" '
57 - IPLDHASH=$(cat ipld_object | ipfs dag put -i dag-json -s dag-cbor)
57 + IPLDHASH=$(cat ipld_object | ipfs dag put --input-codec dag-json --store-codec dag-cbor)
58 '
59
60 test_expect_success "CID looks correct" '
@@ -75,7 +75,7 @@ test_dag_cmd() {
75 # (1) dag-cbor input
76
77 test_expect_success "can add a dag-cbor input block stored as dag-cbor" '
78 - IPLDCBORHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-cbor)
78 + IPLDCBORHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-cbor)
79 '
80
81 test_expect_success "dag-cbor CID looks correct" '
@@ -84,7 +84,7 @@ test_dag_cmd() {
84 '
85
86 test_expect_success "can add a dag-cbor input block stored as dag-pb" '
87 - IPLDPBHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-pb)
87 + IPLDPBHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-pb)
88 '
89
90 test_expect_success "dag-pb CID looks correct" '
@@ -93,7 +93,7 @@ test_dag_cmd() {
93 '
94
95 test_expect_success "can add a dag-cbor input block stored as dag-json" '
96 - IPLDJSONHASH=$(cat ipld_object_dagcbor | ipfs dag put -i dag-cbor -s dag-json)
96 + IPLDJSONHASH=$(cat ipld_object_dagcbor | ipfs dag put --input-codec dag-cbor --store-codec dag-json)
97 '
98
99 test_expect_success "dag-json CID looks correct" '
@@ -104,7 +104,7 @@ test_dag_cmd() {
104 # (2) dag-json input
105
106 test_expect_success "can add a dag-json input block stored as dag-cbor" '
107 - IPLDCBORHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-cbor)
107 + IPLDCBORHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-cbor)
108 '
109
110 test_expect_success "dag-cbor CID looks correct" '
@@ -113,7 +113,7 @@ test_dag_cmd() {
113 '
114
115 test_expect_success "can add a dag-json input block stored as dag-pb" '
116 - IPLDPBHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-pb)
116 + IPLDPBHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-pb)
117 '
118
119 test_expect_success "dag-pb CID looks correct" '
@@ -122,7 +122,7 @@ test_dag_cmd() {
122 '
123
124 test_expect_success "can add a dag-json input block stored as dag-json" '
125 - IPLDJSONHASH=$(cat ipld_object_dagjson | ipfs dag put -i dag-json -s dag-json)
125 + IPLDJSONHASH=$(cat ipld_object_dagjson | ipfs dag put --input-codec dag-json --store-codec dag-json)
126 '
127
128 test_expect_success "dag-json CID looks correct" '
@@ -133,7 +133,7 @@ test_dag_cmd() {
133 # (3) dag-pb input
134
135 test_expect_success "can add a dag-pb input block stored as dag-cbor" '
136 - IPLDCBORHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-cbor)
136 + IPLDCBORHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-cbor)
137 '
138
139 test_expect_success "dag-cbor CID looks correct" '
@@ -142,7 +142,7 @@ test_dag_cmd() {
142 '
143
144 test_expect_success "can add a dag-pb input block stored as dag-pb" '
145 - IPLDPBHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-pb)
145 + IPLDPBHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-pb)
146 '
147
148 test_expect_success "dag-pb CID looks correct" '
@@ -151,7 +151,7 @@ test_dag_cmd() {
151 '
152
153 test_expect_success "can add a dag-pb input block stored as dag-json" '
154 - IPLDJSONHASH=$(cat ipld_object_dagpb | ipfs dag put -i dag-pb -s dag-json)
154 + IPLDJSONHASH=$(cat ipld_object_dagpb | ipfs dag put --input-codec dag-pb --store-codec dag-json)
155 '
156
157 test_expect_success "dag-json CID looks correct" '
@@ -245,7 +245,7 @@ test_dag_cmd() {
245 '
246
247 test_expect_success "retrieved object hashes back correctly" '
248 - IPLDHASH2=$(cat ipld_obj_out | ipfs dag put -i dag-json -s dag-cbor) &&
248 + IPLDHASH2=$(cat ipld_obj_out | ipfs dag put --input-codec dag-json --store-codec dag-cbor) &&
249 test "$IPLDHASH" = "$IPLDHASH2"
250 '
251
@@ -272,7 +272,7 @@ test_dag_cmd() {
272 '
273
274 test_expect_success "non-canonical dag-cbor input is normalized" '
275 - HASH=$(cat ../t0053-dag-data/non-canon.cbor | ipfs dag put -s dag-cbor -i dag-cbor) &&
275 + HASH=$(cat ../t0053-dag-data/non-canon.cbor | ipfs dag put --store-codec dag-cbor --input-codec dag-cbor) &&
276 test $HASH = "bafyreiawx7ona7oa2ptcoh6vwq4q6bmd7x2ibtkykld327bgb7t73ayrqm" ||
277 test_fsh echo $HASH
278 '
@@ -283,7 +283,7 @@ test_dag_cmd() {
283 '
284
285 test_expect_success "add an ipld with pin" '
286 - PINHASH=$(printf {\"foo\":\"bar\"} | ipfs dag put -i dag-json --pin=true)
286 + PINHASH=$(printf {\"foo\":\"bar\"} | ipfs dag put --input-codec dag-json --pin=true)
287 '
288
289 test_expect_success "after gc, objects still accessible" '
test/sharness/t0055-dag-put-json-new-line.sh
+2 -2
@@ -14,8 +14,8 @@ test_expect_success 'create test JSON files' '
14 '
15
16 test_expect_success 'puts as CBOR work' '
17 - GOT_HASH_WITHOUT_NEWLINE="$(cat without_newline.json | ipfs dag put -s dag-cbor)"
18 - GOT_HASH_WITH_NEWLINE="$(cat with_newline.json | ipfs dag put -s dag-cbor)"
17 + GOT_HASH_WITHOUT_NEWLINE="$(cat without_newline.json | ipfs dag put --store-codec dag-cbor)"
18 + GOT_HASH_WITH_NEWLINE="$(cat with_newline.json | ipfs dag put --store-codec dag-cbor)"
19 '
20
21 test_expect_success 'put hashes with or without newline are equal' '