From 4b34b7c437ab7dcf123e164cf1a77225ef277e88 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 20 Sep 2018 10:28:20 +0100 Subject: [PATCH] fix: simplify ls License: MIT Signed-off-by: Alan Shaw --- src/cli/commands/ls.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli/commands/ls.js b/src/cli/commands/ls.js index cb882836fb..7e05e7acf0 100644 --- a/src/cli/commands/ls.js +++ b/src/cli/commands/ls.js @@ -33,22 +33,22 @@ module.exports = { } }, - handler (argv) { - argv.ipfs.ls(argv.key, { recursive: argv.recursive, cidBase: argv.cidBase }, (err, links) => { + handler ({ ipfs, key, recursive, headers, cidBase }) { + ipfs.ls(key, { recursive, cidBase }, (err, links) => { if (err) { throw err } - if (argv.headers) { + if (headers) { links = [{ hash: 'Hash', size: 'Size', name: 'Name' }].concat(links) } const multihashWidth = Math.max.apply(null, links.map((file) => file.hash.length)) const sizeWidth = Math.max.apply(null, links.map((file) => String(file.size).length)) - let pathParts = argv.key.split('/') + let pathParts = key.split('/') - if (argv.key.startsWith('/ipfs/')) { + if (key.startsWith('/ipfs/')) { pathParts = pathParts.slice(2) }