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

Commit

Permalink
Bring back missing help text. Fixes #1362. (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzyTew authored and DeviaVir committed Mar 7, 2018
1 parent 745a43e commit 3d93554
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
8 changes: 4 additions & 4 deletions commands/backfill/backfill.js → commands/new_backfill.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
var minimist = require('minimist')
, tb = require('timebucket')
, exchangeService = require('../../lib/services/exchange-service')
, objectifySelector = require('../../lib/objectify-selector')
, backfillFunction = require('./backfill.function')
, exchangeService = require('../lib/services/exchange-service')
, objectifySelector = require('../lib/objectify-selector')
, backfillFunction = require('./backfill/backfill.function')

module.exports = function(program, conf) {
program
.command('backfill [selector]')
.command('new_backfill [selector]')
.description('download historical trades for analysis')
.option('-d, --days <days>', 'number of days to acquire (default: ' + conf.days + ')', Number, conf.days)
.action(function (selector, cmd) {
Expand Down
26 changes: 9 additions & 17 deletions zenbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ boot(function (err, zenbot) {
}
program.version(zenbot.version)

var command_name = process.argv[2]

var command_directory = './commands'
fs.readdir(command_directory, function(err, files){
if (err) {
Expand All @@ -33,24 +31,18 @@ boot(function (err, zenbot) {
}).filter((file)=>{
return fs.statSync(file).isFile()
})

if(command_name)
var command_found = (commands.indexOf(path.join(command_directory, command_name)+'.js') !== -1)

if(command_found) {
var command = require(path.resolve(__dirname, `./commands/${command_name}`))
command(program, zenbot.conf)
}
commands.forEach((file)=>{
require(path.resolve(__dirname, file.replace('.js','')))(program, zenbot.conf)
})

if(command_name === 'new_backfill'){
command_found = true
command = require(path.resolve(__dirname,'./commands/backfill/backfill'))
command(program, zenbot.conf)
}
program
.command('*', 'Display help', { noHelp: true })
.action((cmd)=>{
console.log('Invalid command: ' + cmd)
program.help()
})

if (!command_name || !command_found && (!process.argv[2] || !process.argv[2].match(/^-V|--version$/))) {
program.help()
}
program.parse(process.argv)
})
})

0 comments on commit 3d93554

Please sign in to comment.