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

Commit 94791b8

Browse files
committed
fix(cli): use right argument for cli .cat
Add tests for making sure .cat shows right output and fix that test by using the right argument from cli. Ref: issue #476
1 parent 636307f commit 94791b8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/cli/commands/files/cat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
builder: {},
1414

1515
handler (argv) {
16-
const path = argv.ipfsPath
16+
const path = argv['ipfs-path']
1717
utils.getIPFS((err, ipfs) => {
1818
if (err) {
1919
throw err

test/cli/test-files.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ const _ = require('lodash')
99

1010
describe('files', () => {
1111
const env = _.clone(process.env)
12-
env.IPFS_PATH = repoPath
12+
process.env.IPFS_PATH = repoPath
1313

1414
describe('api offline', () => {
1515
it('cat', (done) => {
1616
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'files', 'cat', 'QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o'], {env})
1717
.run((err, stdout, exitcode) => {
1818
expect(err).to.not.exist
1919
expect(exitcode).to.equal(0)
20+
expect(stdout[0]).to.equal('hello world')
2021
done()
2122
})
2223
})

0 commit comments

Comments
 (0)