Skip to content

Commit

Permalink
fix: show commands with --help
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernanda Andrade committed Nov 26, 2018
1 parent 9119c79 commit 32c5cde
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/commands/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exports.builder =
describe: 'Pass template option to dialect, PostgreSQL only',
type: 'string'
})
.help()
.argv;

exports.handler = async function (args) {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exports.builder = yargs => _baseOptions(yargs)
type: 'boolean',
default: false
})
.help()
.argv;

exports.handler = async function (argv) {
Expand Down Expand Up @@ -62,4 +61,4 @@ function initMigrations (args) {

function initSeeders (args) {
helpers.init.createSeedersFolder(!!args.force);
}
}
2 changes: 1 addition & 1 deletion src/commands/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exports.builder = yargs => _baseOptions(yargs)
describe: 'Migration name to start migrations from (excluding)',
type: 'string'
})
.help()
.argv;

exports.handler = async function (args) {
const command = args._[0];

Expand Down
3 changes: 1 addition & 2 deletions src/commands/migrate_undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ exports.builder =
describe: 'Name of the migration to undo',
type: 'string'
})
.help()
.argv;

exports.handler = async function (args) {
Expand Down Expand Up @@ -39,4 +38,4 @@ function migrateUndo (args) {
}
});
}).catch(e => helpers.view.error(e));
}
}
3 changes: 1 addition & 2 deletions src/commands/migrate_undo_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exports.builder =
default: 0,
type: 'string'
})
.help()
.argv;

exports.handler = async function (args) {
Expand All @@ -34,4 +33,4 @@ function migrationUndoAll (args) {
})
.then(() => migrator.down({ to: args.to || 0 }));
}).catch(e => helpers.view.error(e));
}
}
3 changes: 1 addition & 2 deletions src/commands/migration_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exports.builder =
demandOption: true
})
)
.help()
.argv;

exports.handler = function (args) {
Expand All @@ -34,4 +33,4 @@ exports.handler = function (args) {
);

process.exit(0);
};
};
1 change: 0 additions & 1 deletion src/commands/model_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ exports.builder =
demandOption: false
})
)
.help()
.argv;

exports.handler = function (args) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getMigrator } from '../core/migrator';
import helpers from '../helpers';
import _ from 'lodash';

exports.builder = yargs => _baseOptions(yargs).help().argv;
exports.builder = yargs => _baseOptions(yargs).argv;
exports.handler = async function (args) {
const command = args._[0];

Expand Down
1 change: 0 additions & 1 deletion src/commands/seed_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exports.builder =
type: 'string',
demandOption: true
})
.help()
.argv;

exports.handler = function (args) {
Expand Down
1 change: 0 additions & 1 deletion src/commands/seed_one.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exports.builder =
describe: 'List of seed files',
type: 'array'
})
.help()
.argv;

exports.handler = async function (args) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/yargs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function loadRCFile(optionsPath) {
}

const args = yargs
.help(false)
.version(false)
.config(loadRCFile(yargs.argv.optionsPath));

export default function getYArgs () {
Expand Down
5 changes: 3 additions & 2 deletions src/sequelize.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import helpers from './helpers/index';
helpers.view.teaser();

const cli = yargs
.help()
.version()
.command('db:migrate', 'Run pending migrations', migrate)
.command('db:migrate:schema:timestamps:add', 'Update migration table to have timestamps', migrate)
.command('db:migrate:status', 'List the status of all migrations', migrate)
Expand All @@ -54,8 +56,7 @@ const cli = yargs
.command(['model:generate', 'model:create'], 'Generates a model and its migration', modelGenerate)
.command(['seed:generate', 'seed:create'], 'Generates a new seed file', seedGenerate)
.wrap(yargs.terminalWidth())
.strict()
.help();
.strict();

const args = cli.argv;

Expand Down

0 comments on commit 32c5cde

Please sign in to comment.