Skip to content

Commit

Permalink
Remove argv support; use user input
Browse files Browse the repository at this point in the history
  • Loading branch information
pateketrueke committed Mar 24, 2019
1 parent 1d26678 commit 0057e4e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
18 changes: 6 additions & 12 deletions cli/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const argv = require('wargs')(process.argv.slice(2));

const cmd = argv._.shift();

const USAGE_INFO = `
Perform database changes
Expand Down Expand Up @@ -35,20 +31,18 @@ Examples:
{bin} backup --save path/to/seeds --only Product,Cart
`;

const defaults = {
migrations: argv._.slice(),
options: argv.flags,
};

function getHelp(binary) {
return USAGE_INFO.replace(/{bin}/g, binary || process.argv.slice(1)[0]);
}

function runHook(moduleName) {
return conn => require(`./${moduleName}`)(conn, defaults);
function runHook(argv, conn) {
return require(`./${argv._.shift()}`)(conn, {
migrations: argv._.slice(),
options: argv.flags,
});
}

module.exports = {
usage: getHelp,
execute: runHook(cmd),
execute: runHook,
};
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"fs-extra": "^7.0.1",
"glob": "^7.1.2",
"sequelize": "^4.22.5",
"umzug": "^2.0.1",
"wargs": "^0.8.1"
"umzug": "^2.0.1"
}
}

0 comments on commit 0057e4e

Please sign in to comment.