Skip to content

Commit e136a5f

Browse files
committed
Try using yargs instead of optimits
Signed-off-by: Vlad GURDIGA <[email protected]>
1 parent 4caaf39 commit e136a5f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/commands/set-default-argv.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var optimist = require('optimist');
1+
var argParser = require('yargs');
22
var log = require('db-migrate-shared').log;
33

44
module.exports = function (internals, isModule) {
@@ -20,7 +20,7 @@ module.exports = function (internals, isModule) {
2020
};
2121

2222
if (!isModule) {
23-
internals.argv = optimist
23+
internals.argv = argParser
2424
.default(defaultConfig)
2525
.usage(
2626
'Usage: db-migrate [up|down|check|reset|sync|create|db|transition] ' +
@@ -110,7 +110,8 @@ module.exports = function (internals, isModule) {
110110
.describe('ignore-completed-migrations', 'Start at the first migration')
111111
.boolean('ignore-completed-migrations')
112112
.describe('log-level', 'Set the log-level, for example sql|warn')
113-
.string('log-level');
113+
.string('log-level')
114+
.parse();
114115
} else {
115116
const _internalsArgv = Object.assign(defaultConfig, internals.cmdOptions);
116117
internals.argv = {
@@ -128,7 +129,7 @@ module.exports = function (internals, isModule) {
128129
plugin.forEach(function (plugin) {
129130
// var configs = plugin['init:cli:config:hook']();
130131
// if (!configs) return;
131-
// hook not yet used, we look into migrating away from optimist first
132+
// hook not yet used, we look into migrating away from argParser first
132133
});
133134
}
134135

@@ -142,7 +143,7 @@ module.exports = function (internals, isModule) {
142143
}
143144

144145
if (!isModule && (internals.argv.help || internals.argv._.length === 0)) {
145-
optimist.showHelp();
146+
argParser.showHelp();
146147
process.exit(1);
147148
}
148149

0 commit comments

Comments
 (0)