* Main program.
()
| 445 | */ |
| 446 | |
| 447 | function main () { |
| 448 | // Path |
| 449 | var destinationPath = program.args.shift() || '.' |
| 450 | |
| 451 | // App name |
| 452 | var appName = createAppName(path.resolve(destinationPath)) || 'hello-world' |
| 453 | |
| 454 | // View engine |
| 455 | if (program.view === true) { |
| 456 | if (program.ejs) program.view = 'ejs' |
| 457 | if (program.hbs) program.view = 'hbs' |
| 458 | if (program.hogan) program.view = 'hjs' |
| 459 | if (program.pug) program.view = 'pug' |
| 460 | } |
| 461 | |
| 462 | // Default view engine |
| 463 | if (program.view === true) { |
| 464 | warning('the default view engine will not be jade in future releases\n' + |
| 465 | "use `--view=jade' or `--help' for additional options") |
| 466 | program.view = 'jade' |
| 467 | } |
| 468 | |
| 469 | // Generate application |
| 470 | emptyDirectory(destinationPath, function (empty) { |
| 471 | if (empty || program.force) { |
| 472 | createApplication(appName, destinationPath) |
| 473 | } else { |
| 474 | confirm('destination is not empty, continue? [y/N] ', function (ok) { |
| 475 | if (ok) { |
| 476 | process.stdin.destroy() |
| 477 | createApplication(appName, destinationPath) |
| 478 | } else { |
| 479 | console.error('aborting') |
| 480 | exit(1) |
| 481 | } |
| 482 | }) |
| 483 | } |
| 484 | }) |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * Make the given dir relative to base. |
no test coverage detected