Skip to content

Commit

Permalink
fix: fix formatting of mode and optional mtimes (ipfs#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Jan 10, 2020
1 parent 009fb98 commit 5747297
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/cli/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
Expand Down Expand Up @@ -81,8 +83,8 @@ Mtime: <mtime>`,
.replace('<cumulsize>', stats.cumulativeSize)
.replace('<childs>', stats.blocks)
.replace('<type>', stats.type)
.replace('<mode>', stats.mode)
.replace('<mtime>', stats.mtime)
.replace('<mode>', formatMode(stats.mode, stats.type === 'directory'))
.replace('<mtime>', formatMtime(stats.mtime))
)
})
})())
Expand Down
2 changes: 1 addition & 1 deletion test/cli/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ describe('stat', () => {
path,
defaultOptions()
])
expect(output).to.equal('stats-mode stats-type\n')
expect(output).to.equal('---------- stats-type\n')
})
})

0 comments on commit 5747297

Please sign in to comment.