This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from ipfs/feature/cli-commands
Add ipfs commands to cli
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) | ||
}) |