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

Commit 90c57bd

Browse files
author
Alan Shaw
committed
fix: simplify ls
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 159e76a commit 90c57bd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/cli/commands/ls.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ module.exports = {
3333
}
3434
},
3535

36-
handler (argv) {
37-
argv.ipfs.ls(argv.key, { recursive: argv.recursive, cidBase: argv.cidBase }, (err, links) => {
36+
handler ({ ipfs, key, recursive, headers, cidBase }) {
37+
ipfs.ls(key, { recursive, cidBase }, (err, links) => {
3838
if (err) {
3939
throw err
4040
}
4141

42-
if (argv.headers) {
42+
if (headers) {
4343
links = [{hash: 'Hash', size: 'Size', name: 'Name'}].concat(links)
4444
}
4545

4646
const multihashWidth = Math.max.apply(null, links.map((file) => file.hash.length))
4747
const sizeWidth = Math.max.apply(null, links.map((file) => String(file.size).length))
4848

49-
let pathParts = argv.key.split('/')
49+
let pathParts = key.split('/')
5050

51-
if (argv.key.startsWith('/ipfs/')) {
51+
if (key.startsWith('/ipfs/')) {
5252
pathParts = pathParts.slice(2)
5353
}
5454

0 commit comments

Comments
 (0)