#!/usr/bin/env node const bip32 = require("bip32"); const yargs = require('yargs'); const path = require('path'); const fs = require('fs'); const cli = yargs .help() .version() .strict(); // Lets load up all the commands written in the commands directory var commandsDirectory = path.join(__dirname, './commands/'); fs.readdirSync(commandsDirectory) .filter(file => { return (file.indexOf('.') !== 0) && (file !== "index.js") && (file.slice(-3) === '.js'); }) .forEach(file => { const command = require(path.join(commandsDirectory, file)); cli.command(file, command.description, command); }); const args = cli.argv; // show help if no command provided if (!args._[0]) { cli.showHelp(); }