From 57472970bde1f36f525b0e65f29bb2e5c32a6717 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 10 Jan 2020 11:55:43 +0000 Subject: [PATCH] fix: fix formatting of mode and optional mtimes (#70) --- src/cli/stat.js | 6 ++++-- test/cli/stat.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cli/stat.js b/src/cli/stat.js index c2c6bd3..15f18ef 100644 --- a/src/cli/stat.js +++ b/src/cli/stat.js @@ -3,6 +3,8 @@ const { asBoolean } = require('./utils') +const formatMode = require('ipfs-utils/src/files/format-mode') +const formatMtime = require('ipfs-utils/src/files/format-mtime') module.exports = { command: 'stat [path]', @@ -81,8 +83,8 @@ Mtime: `, .replace('', stats.cumulativeSize) .replace('', stats.blocks) .replace('', stats.type) - .replace('', stats.mode) - .replace('', stats.mtime) + .replace('', formatMode(stats.mode, stats.type === 'directory')) + .replace('', formatMtime(stats.mtime)) ) }) })()) diff --git a/test/cli/stat.js b/test/cli/stat.js index 2ff7736..7f3e441 100644 --- a/test/cli/stat.js +++ b/test/cli/stat.js @@ -137,6 +137,6 @@ describe('stat', () => { path, defaultOptions() ]) - expect(output).to.equal('stats-mode stats-type\n') + expect(output).to.equal('---------- stats-type\n') }) })