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

Commit af8200d

Browse files
committed
fix: Add ipfs path to cli help
1 parent 93d2bf5 commit af8200d

File tree

6 files changed

+35
-15
lines changed

6 files changed

+35
-15
lines changed

src/cli/bin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const cli = yargs
2929
default: ''
3030
})
3131
.commandDir('commands')
32+
.epilog(utils.ipfsPathHelp)
3233
.demandCommand(1)
3334
.fail((msg, err, yargs) => {
3435
if (err) {

src/cli/commands/daemon.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ module.exports = {
1111

1212
describe: 'Start a long-running daemon process',
1313

14-
builder: {
15-
'enable-sharding-experiment': {
16-
type: 'boolean',
17-
default: false
18-
},
19-
'enable-pubsub-experiment': {
20-
type: 'boolean',
21-
default: false
22-
}
14+
builder (yargs) {
15+
return yargs
16+
.epilog(utils.ipfsPathHelp)
17+
.option('enable-sharding-experiment', {
18+
type: 'boolean',
19+
default: false
20+
})
21+
.option('enable-pubsub-experiment', {
22+
type: 'boolean',
23+
default: false
24+
})
2325
},
2426

2527
handler (argv) {

src/cli/commands/init.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ const IPFS = require('../../core')
55
const utils = require('../utils')
66
const print = utils.print
77

8-
const ipfsPathHelp = 'ipfs uses a repository in the local file system. By default, the repo is ' +
9-
'located at ~/.ipfs.\nTo change the repo location, set the $IPFS_PATH environment variable:\n\n' +
10-
'\texport IPFS_PATH=/path/to/ipfsrepo\n'
11-
128
module.exports = {
139
command: 'init',
1410

1511
describe: 'Initialize a local IPFS node',
1612

1713
builder (yargs) {
18-
print(ipfsPathHelp)
19-
2014
return yargs
15+
.epilog(utils.ipfsPathHelp)
2116
.option('bits', {
2217
type: 'number',
2318
alias: 'b',

src/cli/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ exports.rightpad = (val, n) => {
111111
}
112112
return result
113113
}
114+
115+
exports.ipfsPathHelp = 'ipfs uses a repository in the local file system. By default, the repo is ' +
116+
'located at ~/.jsipfs. To change the repo location, set the $IPFS_PATH environment variable:\n\n' +
117+
'export IPFS_PATH=/path/to/ipfsrepo\n'

test/cli/daemon.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,13 @@ describe('daemon', () => {
120120
done()
121121
})
122122
})
123+
124+
it('should present ipfs path help when option help is received', function (done) {
125+
this.timeout(100 * 1000)
126+
127+
ipfs('daemon --help').then((res) => {
128+
expect(res).to.have.string('export IPFS_PATH=/path/to/ipfsrepo')
129+
done()
130+
})
131+
})
123132
})

test/cli/init.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,13 @@ describe('init', function () {
6666
expect(repoExistsSync('version')).to.equal(true)
6767
})
6868
})
69+
70+
it('should present ipfs path help when option help is received', function (done) {
71+
this.timeout(100 * 1000)
72+
73+
ipfs('init --help').then((res) => {
74+
expect(res).to.have.string('export IPFS_PATH=/path/to/ipfsrepo')
75+
done()
76+
})
77+
})
6978
})

0 commit comments

Comments
 (0)