Skip to content

Commit

Permalink
fix(CLI-OPTIONS): fix --help (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeucano authored Jul 10, 2020
1 parent 66cf8ae commit 6f0738f
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 101 deletions.
2 changes: 1 addition & 1 deletion libs/scully-schematics/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/scully-schematics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scullyio/init",
"version": "0.0.28",
"version": "0.0.29",
"description": "Add scully to your angular app",
"repository": {
"type": "GIT",
Expand Down
206 changes: 107 additions & 99 deletions libs/scully/src/lib/utils/cli-options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as yargs from 'yargs';
import yargs from 'yargs';

export const {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
watch,
removeStaticDist,
openNavigator,
Expand All @@ -10,8 +12,25 @@ export const {
tds,
proxyConfigFile,
hostName,
showBrowser,
path,
port,
folder,
sge,
configFileName,
project,
baseFilter,
routeFilter,
scanRoutes,
pjFirst,
serverTimeout,
pluginsError,
handle404,
prod,
} =
/** return the argv */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
yargs
/** watch mode */
.boolean('w')
Expand Down Expand Up @@ -59,107 +78,96 @@ export const {
.string('hostName')
.default('hostName', undefined)
.alias('host', 'hostName')
.describe('host', 'Add hostname for scully').argv;
.describe('host', 'Add hostname for scully')

/** break up, bcs the linter doesn't like those long lists */
export const { showBrowser, path, port, folder, sge } = yargs
/** path */
.string('path')
.default('path', undefined)
.alias('p', 'path')
.describe('path', 'The path to generate')
/** port */
.number('port')
.default('port', undefined)
.alias('p', 'port')
.describe('port', 'The port to run on')
/** showBrowser */
.boolean('sb')
.alias('sb', 'showBrowser')
.describe('sb', 'Shows the puppeteer controlled browser')
/** folder */
.string('folder')
.default('folder', undefined)
.describe('folder', 'folder')
/** showGuessErrors */
.boolean('sge')
.alias('sge', 'showGuessError')
.describe('sb', 'dumps the error from guess to the console')

/** path */
.string('path')
.default('path', undefined)
.alias('p', 'path')
.describe('path', 'The path to generate')
/** port */
.number('port')
.default('port', undefined)
.alias('p', 'port')
.describe('port', 'The port to run on')
/** showBrowser */
.boolean('sb')
.alias('sb', 'showBrowser')
.describe('sb', 'Shows the puppeteer controlled browser')
/** folder */
.string('folder')
.default('folder', undefined)
.describe('folder', 'folder')
/** showGuessErrors */
.boolean('sge')
.alias('sge', 'showGuessError')
.describe('sb', 'dumps the error from guess to the console').argv;

export const {
configFileName,
project,
baseFilter,
routeFilter,
scanRoutes,
} = yargs /** config file */
.string('cf')
.alias('cf', 'configFile')
.alias('cf', 'configFileName')
.default('cf', '')
.describe(
'cf',
'provide name of the config file to use. if the option --project is also there that takes precedence)'
)
/** projectName */
.string('pr')
.alias('pr', 'project')
.default('pr', '')
.describe('pr', 'provide name of the project to handle')
/** scanRoutes */
.boolean('sr')
.default('sr', false)
.alias('sr', 'scanRoutes')
.alias('sr', 'scan')
.describe('sr', 'Scan the app for unhandled routes')
/** baseFilter */
.string('bf')
.alias('bf', 'baseFilter')
.default('bf', '')
.describe(
'bf',
'provide a wildcard string separated by ,(comma) to filter the unhandled routes'
)
/** filter */
.string('routeFilter')
.alias('routeFilter', 'rf')
.default('routeFilter', '')
.describe(
'routeFilter',
'provide a wildcard string separated by ,(comma) to filter the handled routes'
).argv;
.string('cf')
.alias('cf', 'configFile')
.alias('cf', 'configFileName')
.default('cf', '')
.describe(
'cf',
'provide name of the config file to use. if the option --project is also there that takes precedence)'
)
/** projectName */
.string('pr')
.alias('pr', 'project')
.default('pr', '')
.describe('pr', 'provide name of the project to handle')
/** scanRoutes */
.boolean('sr')
.default('sr', false)
.alias('sr', 'scanRoutes')
.alias('sr', 'scan')
.describe('sr', 'Scan the app for unhandled routes')
/** baseFilter */
.string('bf')
.alias('bf', 'baseFilter')
.default('bf', '')
.describe(
'bf',
'provide a wildcard string separated by ,(comma) to filter the unhandled routes'
)
/** filter */
.string('routeFilter')
.alias('routeFilter', 'rf')
.default('routeFilter', '')
.describe(
'routeFilter',
'provide a wildcard string separated by ,(comma) to filter the handled routes'
)

export const { pjFirst, serverTimeout, pluginsError, handle404, prod } = yargs
/** server Timout */
.number('st')
.default('st', 0)
.alias('st', 'serverTimeout')
.describe(
'st',
'The time Scully will wait for the server before timeout. in milliseconds'
)
/** package json fist */
.boolean('pjf')
.default('pjf', false)
.alias('pjf', 'pjFirst')
.alias('pjf', 'pj-first')
.describe('pjf', 'Scan for package.json first instead of angular.json')
/** handle 404 in server */
.string('handle404')
.alias('handle404', '404')
.default('handle404', '')
.describe('handle404', 'determine how 404 is handled')
/** Exit Scully with plugin error */
.boolean('pe')
.alias('pe', 'pluginsError')
.default('pe', true)
.describe('pe', "Exit scully's run when exist an error in a plugin")
/** Use Prod Mode */
.boolean('prod')
.alias('prod', 'Production')
.default('prod', false)
.describe('prod', 'Use prod mode for Scully').argv;
/** server Timout */
.number('st')
.default('st', 0)
.alias('st', 'serverTimeout')
.describe(
'st',
'The time Scully will wait for the server before timeout. in milliseconds'
)
/** package json fist */
.boolean('pjf')
.default('pjf', false)
.alias('pjf', 'pjFirst')
.alias('pjf', 'pj-first')
.describe('pjf', 'Scan for package.json first instead of angular.json')
/** handle 404 in server */
.string('handle404')
.alias('handle404', '404')
.default('handle404', '')
.describe('handle404', 'determine how 404 is handled')
/** Exit Scully with plugin error */
.boolean('pe')
.alias('pe', 'pluginsError')
.default('pe', true)
.describe('pe', "Exit scully's run when exist an error in a plugin")
/** Use Prod Mode */
.boolean('prod')
.alias('prod', 'Production')
.default('prod', false)
.describe('prod', 'Use prod mode for Scully').argv;

yargs.help();

Expand Down

0 comments on commit 6f0738f

Please sign in to comment.