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

fix: Add ipfs path to cli help #1302

Merged
merged 1 commit into from
Apr 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const cli = yargs
default: ''
})
.commandDir('commands')
.epilog(utils.ipfsPathHelp)
.demandCommand(1)
.fail((msg, err, yargs) => {
if (err) {
Expand Down
20 changes: 11 additions & 9 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ module.exports = {

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

builder: {
'enable-sharding-experiment': {
type: 'boolean',
default: false
},
'enable-pubsub-experiment': {
type: 'boolean',
default: false
}
builder (yargs) {
return yargs
.epilog(utils.ipfsPathHelp)
.option('enable-sharding-experiment', {
type: 'boolean',
default: false
})
.option('enable-pubsub-experiment', {
type: 'boolean',
default: false
})
},

handler (argv) {
Expand Down
7 changes: 1 addition & 6 deletions src/cli/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ const IPFS = require('../../core')
const utils = require('../utils')
const print = utils.print

const ipfsPathHelp = 'ipfs uses a repository in the local file system. By default, the repo is ' +
'located at ~/.ipfs.\nTo change the repo location, set the $IPFS_PATH environment variable:\n\n' +
'\texport IPFS_PATH=/path/to/ipfsrepo\n'

module.exports = {
command: 'init',

describe: 'Initialize a local IPFS node',

builder (yargs) {
print(ipfsPathHelp)

return yargs
.epilog(utils.ipfsPathHelp)
.option('bits', {
type: 'number',
alias: 'b',
Expand Down
4 changes: 4 additions & 0 deletions src/cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@ exports.rightpad = (val, n) => {
}
return result
}

exports.ipfsPathHelp = 'ipfs uses a repository in the local file system. By default, the repo is ' +
'located at ~/.jsipfs. To change the repo location, set the $IPFS_PATH environment variable:\n\n' +
'export IPFS_PATH=/path/to/ipfsrepo\n'
9 changes: 9 additions & 0 deletions test/cli/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,13 @@ describe('daemon', () => {
done()
})
})

it('should present ipfs path help when option help is received', function (done) {
this.timeout(100 * 1000)

ipfs('daemon --help').then((res) => {
expect(res).to.have.string('export IPFS_PATH=/path/to/ipfsrepo')
done()
})
})
})
9 changes: 9 additions & 0 deletions test/cli/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@ describe('init', function () {
expect(repoExistsSync('version')).to.equal(true)
})
})

it('should present ipfs path help when option help is received', function (done) {
this.timeout(100 * 1000)

ipfs('init --help').then((res) => {
expect(res).to.have.string('export IPFS_PATH=/path/to/ipfsrepo')
done()
})
})
})