File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,8 @@ type BuildArgs = {
2929async function build ( args : string [ ] ) {
3030 let options : BuildArgs ;
3131
32- if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
33- help ( ) ;
34- return ;
35- }
36-
3732 try {
38- // default .
33+ // dir - default .
3934 const dir = args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
4035 // -m --markdown - default TUTORIAL.md
4136 const markdown =
Original file line number Diff line number Diff line change 11import "./utils/logs" ;
22import build from "./build" ;
33import create from "./create" ;
4- import help from "./help" ;
4+ import { help , create as createHelp , build as buildHelp } from "./help" ;
55
66export async function cli ( rawArgs : string [ ] ) : Promise < void > {
77 const command : string = rawArgs [ 2 ] ;
@@ -15,10 +15,18 @@ export async function cli(rawArgs: string[]): Promise<void> {
1515 return ;
1616
1717 case "build" :
18+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19+ buildHelp ( ) ;
20+ return ;
21+ }
1822 build ( args ) ;
1923 break ;
2024
2125 case "create" :
26+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
27+ createHelp ( ) ;
28+ return ;
29+ }
2230 create ( args ) ;
2331 break ;
2432
Original file line number Diff line number Diff line change @@ -15,14 +15,11 @@ type CreateArgs = {
1515async function create ( args : string [ ] ) : Promise < void > {
1616 let options : CreateArgs ;
1717
18- if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19- help ( ) ;
20- return ;
21- }
22-
23- // default .
18+ // dir - default .
2419 const dir = ! args . length || args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
20+ // lang - default js
2521 const lang = getArg ( args , { name : "lang" , alias : "l" } ) || "js" ;
22+ // testRunner - default mocha
2623 const testRunner =
2724 getArg ( args , { name : "testRunner" , alias : "t" } ) || "mocha" ;
2825
Original file line number Diff line number Diff line change 1- export default function help ( ) {
1+ export function help ( ) {
22 console . log ( `
33Usage: coderoad [options]
44
You can’t perform that action at this time.
0 commit comments