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

Commit de3aa7d

Browse files
committed
Merge pull request #48 from ipfs/feat/config
WIP feat/config
2 parents 24f126a + 64154d6 commit de3aa7d

File tree

28 files changed

+314
-109
lines changed

28 files changed

+314
-109
lines changed

src/cli/commands/add.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {}
8+
run: name => {
9+
}
910
})

src/cli/commands/bootstrap/list.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ module.exports = Command.extend({
1515
var node = new IPFS()
1616
node.bootstrap.list((err, list) => {
1717
if (err) { return log.error(err) }
18-
list.forEach(node => { console.log(node) })
18+
list.forEach(node => {
19+
console.log(node)
20+
})
1921
})
2022
}
2123
})

src/cli/commands/commands.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {}
8+
run: name => {
9+
}
910
})

src/cli/commands/config/edit.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict'
2+
3+
const Command = require('ronin').Command
4+
const IPFS = require('../../../ipfs-core')
5+
const debug = require('debug')
6+
const log = debug('cli:version')
7+
log.error = debug('cli:version:error')
8+
9+
module.exports = Command.extend({
10+
desc: 'Shows IPFS version information',
11+
12+
options: {
13+
number: {
14+
alias: 'n',
15+
type: 'boolean',
16+
default: false
17+
},
18+
commit: {
19+
type: 'boolean',
20+
default: false
21+
},
22+
repo: {
23+
type: 'boolean',
24+
default: false
25+
}
26+
},
27+
28+
run: (name) => {
29+
var node = new IPFS()
30+
node.version((err, version) => {
31+
if (err) { return log.error(err) }
32+
33+
console.log(version)
34+
})
35+
}
36+
})

src/cli/commands/config/replace.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict'
2+
3+
const Command = require('ronin').Command
4+
const IPFS = require('../../../ipfs-core')
5+
const debug = require('debug')
6+
const path = require('path')
7+
const log = debug('cli:version')
8+
log.error = debug('cli:version:error')
9+
10+
module.exports = Command.extend({
11+
desc: 'Replaces the config with <file>',
12+
13+
options: {},
14+
15+
run: (configPath) => {
16+
var node = new IPFS()
17+
var config = require(path.resolve(process.cwd(), configPath))
18+
19+
node.config.replace(config, (err, version) => {
20+
if (err) { return log.error(err) }
21+
22+
console.log(version)
23+
})
24+
}
25+
})

src/cli/commands/config/show.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
3+
const Command = require('ronin').Command
4+
const IPFS = require('../../../ipfs-core')
5+
const debug = require('debug')
6+
const log = debug('cli:version')
7+
log.error = debug('cli:version:error')
8+
9+
module.exports = Command.extend({
10+
desc: 'Outputs the content of the config file',
11+
12+
options: {},
13+
14+
run: () => {
15+
var node = new IPFS()
16+
node.config.show((err, config) => {
17+
if (err) { return log.error(err) }
18+
19+
console.log(JSON.stringify(config, null, 4))
20+
})
21+
}
22+
})

src/cli/commands/dns.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {}
8+
run: name => {
9+
}
910
})

src/cli/commands/get.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ const Command = require('ronin').Command
33
module.exports = Command.extend({
44
desc: '',
55

6-
run: name => {}
6+
run: name => {
7+
}
78
})

src/cli/commands/init.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ module.exports = Command.extend({
2020
'empty-repo': {
2121
alias: 'e',
2222
type: 'boolean',
23-
desc: 'Don\'t add and pin help files to the local storage'
23+
desc: "Don't add and pin help files to the local storage"
2424
}
2525
},
2626

27-
run: name => {}
27+
run: name => {
28+
}
2829
})

src/cli/commands/ls.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ const Command = require('ronin').Command
55
module.exports = Command.extend({
66
desc: '',
77

8-
run: name => {}
8+
run: name => {
9+
}
910
})

0 commit comments

Comments
 (0)