Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 4d23a7f

Browse files
committed
refactor: cleaner refs param handling
1 parent 6978831 commit 4d23a7f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/cli/commands/refs.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { print } = require('../utils')
44

55
module.exports = {
6-
command: 'refs <key>',
6+
command: 'refs <key> [keys..]',
77

88
describe: 'List links (references) from an object',
99

@@ -37,18 +37,15 @@ module.exports = {
3737
}
3838
},
3939

40-
handler ({ _, getIpfs, key, recursive, format, edges, unique, maxDepth, resolve }) {
41-
// First key is in `key`
42-
// Any subsequent keys are in `_` array after 'refs'
43-
const keys = [key].concat(_.slice(1))
44-
40+
handler ({ getIpfs, key, keys, recursive, format, edges, unique, maxDepth, resolve }) {
4541
resolve((async () => {
4642
if (maxDepth === 0) {
4743
return
4844
}
4945

5046
const ipfs = await getIpfs()
51-
const refs = await ipfs.refs(keys, { recursive, format, edges, unique, maxDepth })
47+
const k = [key].concat(keys)
48+
const refs = await ipfs.refs(k, { recursive, format, edges, unique, maxDepth })
5249
for (const ref of refs) {
5350
if (ref.err) {
5451
print(ref.err, true, true)

0 commit comments

Comments
 (0)