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

Commit

Permalink
Merge pull request #78 from ipfs/feature/cli-commands
Browse files Browse the repository at this point in the history
Add ipfs commands to cli
  • Loading branch information
daviddias committed Mar 4, 2016
2 parents 876ab2e + db52347 commit 05f2549
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/cli/commands/commands.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
'use strict'

const Command = require('ronin').Command
const path = require('path')
const ronin = require('ronin')

module.exports = Command.extend({
desc: '',

run: name => {
const cli = ronin(path.resolve(__dirname, '..'))

cli.setupCommands()

const commands = ['']
.concat(Object.keys(cli.commands))
.map((command) => 'ipfs ' + command)
.join('\n')

console.log(commands)
}
})
16 changes: 16 additions & 0 deletions tests/test-cli/test-commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-env mocha */

const expect = require('chai').expect
const nexpect = require('nexpect')

describe('commands', () => {
it('list the commands', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'commands'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(exitcode).to.equal(0)
expect(stdout.length).to.equal(26)
done()
})
})
})

0 comments on commit 05f2549

Please sign in to comment.