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

Commit

Permalink
add bootstrap list to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jan 11, 2016
1 parent f404a8f commit ef701dc
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/cli/commands/bootstrap/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

const Command = require('ronin').Command
const IPFS = require('../../ipfs-core')
const debug = require('debug')
const log = debug('cli:version')
log.error = debug('cli:version:error')

module.exports = Command.extend({
desc: 'Shows IPFS version information',

options: {
number: {
alias: 'n',
type: 'boolean',
default: false
},
commit: {
type: 'boolean',
default: false
},
repo: {
type: 'boolean',
default: false
}
},

run: (name) => {
var node = new IPFS()
node.version((err, version) => {
if (err) { return log.error(err) }

console.log(version)
})
}
})
21 changes: 21 additions & 0 deletions src/cli/commands/bootstrap/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

const Command = require('ronin').Command
const IPFS = require('../../../ipfs-core')
const debug = require('debug')
const log = debug('cli:version')
log.error = debug('cli:version:error')

module.exports = Command.extend({
desc: 'Show peers in the bootstrap list',

options: {},

run: (name) => {
var node = new IPFS()
node.bootstrap.list((err, list) => {
if (err) { return log.error(err) }
list.forEach(node => { console.log(node) })
})
}
})
36 changes: 36 additions & 0 deletions src/cli/commands/bootstrap/rm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict'

const Command = require('ronin').Command
const IPFS = require('../../ipfs-core')
const debug = require('debug')
const log = debug('cli:version')
log.error = debug('cli:version:error')

module.exports = Command.extend({
desc: 'Shows IPFS version information',

options: {
number: {
alias: 'n',
type: 'boolean',
default: false
},
commit: {
type: 'boolean',
default: false
},
repo: {
type: 'boolean',
default: false
}
},

run: (name) => {
var node = new IPFS()
node.version((err, version) => {
if (err) { return log.error(err) }

console.log(version)
})
}
})
22 changes: 22 additions & 0 deletions src/http-api/routes/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'

const server = require('./../index.js').server
const resources = require('./../resources')

server.route({
method: 'GET',
path: '/api/v0/bootstrap',
handler: resources.version.list
})

server.route({
method: 'POST',
path: '/api/v0/boostrap',

This comment has been minimized.

Copy link
@ralphtheninja

ralphtheninja Jan 11, 2016

bootstrap?

handler: resources.version.add
})

server.route({
method: 'DELETE',
path: '/api/v0/boostrap',

This comment has been minimized.

Copy link
@ralphtheninja

ralphtheninja Jan 11, 2016

d:o

handler: resources.version.add
})

2 comments on commit ef701dc

@daviddias
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed that you meant that there was typos, fixed on master, thanks @ralphtheninja :)

@ralphtheninja
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.