不要怂,就是干,撸起袖子干!

Commit 37244f18 by terraflubb

(Subjectively) improve copy in binary

Also replaced one thrown error with a console.log. The rest of the errors were not thrown, and since this file is run from the shell, it will be an edge case that it will ever be caught. It looks messy when it happens. So it now returns an exit code of 1 to indicate things went sideways.
1 parent 46f5caf9
Showing with 9 additions and 7 deletions
......@@ -66,12 +66,12 @@ var readConfig = function() {
program
.version(packageJson.version)
.option('-i, --init', 'Initializes the project. Creates a config/config.json')
.option('-m, --migrate', 'Runs undone migrations')
.option('-i, --init', 'Initializes the project.')
.option('-e, --env <environment>', 'Specify the environment.')
.option('-m, --migrate', 'Run pending migrations.')
.option('-u, --undo', 'Undo the last migration.')
.option('-f, --force', 'Forces the action to be done.')
.option('-c, --create-migration [migration-name]', 'Create a new migration skeleton file.')
.option('-c, --create-migration [migration-name]', 'Creates a new migration.')
.parse(process.argv)
if(typeof program.env === 'string') {
......@@ -110,7 +110,8 @@ if(program.migrate) {
sequelize.migrate()
}
} else {
throw new Error('Please add a configuration file under config/config.json. You might run "sequelize --init".')
console.log('Cannot find "config/config.json". Have you run "sequelize --init"?')
process.exit(1)
}
} else if(program.init) {
if(!configFileExists || !!program.force) {
......@@ -135,9 +136,10 @@ if(program.migrate) {
}
})
console.log('Successfully created config.json')
console.log('Created "config/config.json"')
} else {
console.log('A config.json already exists. Run "sequelize --init --force" to overwrite it.')
console.log('"config/config.json" already exists. Run "sequelize --init --force" to overwrite.')
process.exit(1)
}
createMigrationsFolder(program.force)
......@@ -162,5 +164,5 @@ if(program.migrate) {
fs.writeFileSync(migrationsPath + '/' + migrationName, migrationContent)
} else {
console.log('Please define any params!')
console.log('Try "sequelize --help" for usage information.')
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!