File tree 4 files changed +14
-14
lines changed
4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,8 @@ type BuildArgs = {
29
29
async function build ( args : string [ ] ) {
30
30
let options : BuildArgs ;
31
31
32
- if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
33
- help ( ) ;
34
- return ;
35
- }
36
-
37
32
try {
38
- // default .
33
+ // dir - default .
39
34
const dir = args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
40
35
// -m --markdown - default TUTORIAL.md
41
36
const markdown =
Original file line number Diff line number Diff line change 1
1
import "./utils/logs" ;
2
2
import build from "./build" ;
3
3
import create from "./create" ;
4
- import help from "./help" ;
4
+ import { help , create as createHelp , build as buildHelp } from "./help" ;
5
5
6
6
export async function cli ( rawArgs : string [ ] ) : Promise < void > {
7
7
const command : string = rawArgs [ 2 ] ;
@@ -15,10 +15,18 @@ export async function cli(rawArgs: string[]): Promise<void> {
15
15
return ;
16
16
17
17
case "build" :
18
+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19
+ buildHelp ( ) ;
20
+ return ;
21
+ }
18
22
build ( args ) ;
19
23
break ;
20
24
21
25
case "create" :
26
+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
27
+ createHelp ( ) ;
28
+ return ;
29
+ }
22
30
create ( args ) ;
23
31
break ;
24
32
Original file line number Diff line number Diff line change @@ -15,14 +15,11 @@ type CreateArgs = {
15
15
async function create ( args : string [ ] ) : Promise < void > {
16
16
let options : CreateArgs ;
17
17
18
- if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19
- help ( ) ;
20
- return ;
21
- }
22
-
23
- // default .
18
+ // dir - default .
24
19
const dir = ! args . length || args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
20
+ // lang - default js
25
21
const lang = getArg ( args , { name : "lang" , alias : "l" } ) || "js" ;
22
+ // testRunner - default mocha
26
23
const testRunner =
27
24
getArg ( args , { name : "testRunner" , alias : "t" } ) || "mocha" ;
28
25
Original file line number Diff line number Diff line change 1
- export default function help ( ) {
1
+ export function help ( ) {
2
2
console . log ( `
3
3
Usage: coderoad [options]
4
4
You can’t perform that action at this time.
0 commit comments