Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 5747297

Browse files
authored
fix: fix formatting of mode and optional mtimes (#70)
1 parent 009fb98 commit 5747297

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cli/stat.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
const {
44
asBoolean
55
} = require('./utils')
6+
const formatMode = require('ipfs-utils/src/files/format-mode')
7+
const formatMtime = require('ipfs-utils/src/files/format-mtime')
68

79
module.exports = {
810
command: 'stat [path]',
@@ -81,8 +83,8 @@ Mtime: <mtime>`,
8183
.replace('<cumulsize>', stats.cumulativeSize)
8284
.replace('<childs>', stats.blocks)
8385
.replace('<type>', stats.type)
84-
.replace('<mode>', stats.mode)
85-
.replace('<mtime>', stats.mtime)
86+
.replace('<mode>', formatMode(stats.mode, stats.type === 'directory'))
87+
.replace('<mtime>', formatMtime(stats.mtime))
8688
)
8789
})
8890
})())

test/cli/stat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ describe('stat', () => {
137137
path,
138138
defaultOptions()
139139
])
140-
expect(output).to.equal('stats-mode stats-type\n')
140+
expect(output).to.equal('---------- stats-type\n')
141141
})
142142
})

0 commit comments

Comments
 (0)