Skip to content

Commit

Permalink
feat(schematics): add a usage information option to create-nx-workspace
Browse files Browse the repository at this point in the history
`create-nx-workspace --help` shows usage information (commande,
description and options) and exit
  • Loading branch information
nweldev authored and vsavkin committed Mar 26, 2018
1 parent 9a40686 commit 2746f03
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/schematics/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,30 @@ import * as yargsParser from 'yargs-parser';
interface CommandOptions {
directory?: string;
yarn: boolean;
help: boolean;
}

const parsedArgs = yargsParser(process.argv, {
string: ['directory'],
boolean: ['yarn']
boolean: ['yarn', 'help']
});

if (parsedArgs.help) {
console.log(`
Usage: create-nx-workspace <directory> [options] [ng new options]
Create a new Nx workspace (that is to say a new angular-cli project using @nrwl/schematics)
Options:
directory path to the workspace root directory
--yarn use yarn instead of npm (default to false)
[ng new options] any 'ng new' options
run 'ng help new' for more informations
`);
process.exit(0);
}
const useYarn = parsedArgs.yarn;

if (!useYarn) {
Expand Down

0 comments on commit 2746f03

Please sign in to comment.