File tree 3 files changed +44
-4
lines changed
3 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { parse } from "./utils/parse";
7
7
import { getArg } from "./utils/args" ;
8
8
import { getCommits , CommitLogObject } from "./utils/commits" ;
9
9
import { validateSchema } from "./utils/validate" ;
10
+ import { build as help } from "./help" ;
10
11
import * as T from "../typings/tutorial" ;
11
12
12
13
const write = util . promisify ( fs . writeFile ) ;
@@ -27,6 +28,12 @@ type BuildArgs = {
27
28
28
29
async function build ( args : string [ ] ) {
29
30
let options : BuildArgs ;
31
+
32
+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
33
+ help ( ) ;
34
+ return ;
35
+ }
36
+
30
37
try {
31
38
// default .
32
39
const dir = args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import ncp from "ncp";
2
2
import * as path from "path" ;
3
3
import { promisify } from "util" ;
4
4
import { getArg } from "./utils/args" ;
5
+ import { create as help } from "./help" ;
5
6
6
7
const copy = promisify ( ncp ) ;
7
8
@@ -14,6 +15,11 @@ type CreateArgs = {
14
15
async function create ( args : string [ ] ) : Promise < void > {
15
16
let options : CreateArgs ;
16
17
18
+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19
+ help ( ) ;
20
+ return ;
21
+ }
22
+
17
23
// default .
18
24
const dir = ! args . length || args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
19
25
const lang = getArg ( args , { name : "lang" , alias : "l" } ) || "js" ;
Original file line number Diff line number Diff line change @@ -3,11 +3,38 @@ export default function help() {
3
3
Usage: coderoad [options]
4
4
5
5
Options:
6
- help display these help docs
7
- version show coderoad cli version
8
- create start a new tutorial from a template
9
- build generate a coderoad.json file from markdown and yaml
6
+ -- help (-h) display these help docs
7
+ -- version (-v) show coderoad cli version
8
+ create start a new tutorial from a template
9
+ build generate a coderoad.json file from markdown and yaml
10
10
11
11
More docs at https://github.com/coderoad/coderoad-cli
12
12
` ) ;
13
13
}
14
+
15
+ export function create ( ) {
16
+ console . log ( `
17
+ Usage: coderoad create [path] [options]
18
+
19
+ Options:
20
+ --help (-h) display these help docs
21
+ --lang (-l) programming language for template
22
+ --testRunner (-t) test runner module for template
23
+
24
+ More docs at https://github.com/coderoad/coderoad-cli
25
+ ` ) ;
26
+ }
27
+
28
+ export function build ( ) {
29
+ console . log ( `
30
+ Usage: coderoad build [path] [options]
31
+
32
+ Options:
33
+ --help (-h) display these help docs
34
+ --markdown (-m) custom path to the tutorial markdown file (TUTORIAL.md)
35
+ --yaml (-y) custom path to the tutorial yaml file (coderoad.yaml)
36
+ --output (-o) custom path to tutorial json config file (coderoad.json)
37
+
38
+ More docs at https://github.com/coderoad/coderoad-cli
39
+ ` ) ;
40
+ }
You can’t perform that action at this time.
0 commit comments