File tree Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Expand file tree Collapse file tree 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";
77import { getArg } from "./utils/args" ;
88import { getCommits , CommitLogObject } from "./utils/commits" ;
99import { validateSchema } from "./utils/validate" ;
10+ import { build as help } from "./help" ;
1011import * as T from "../typings/tutorial" ;
1112
1213const write = util . promisify ( fs . writeFile ) ;
@@ -27,6 +28,12 @@ type BuildArgs = {
2728
2829async function build ( args : string [ ] ) {
2930 let options : BuildArgs ;
31+
32+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
33+ help ( ) ;
34+ return ;
35+ }
36+
3037 try {
3138 // default .
3239 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";
22import * as path from "path" ;
33import { promisify } from "util" ;
44import { getArg } from "./utils/args" ;
5+ import { create as help } from "./help" ;
56
67const copy = promisify ( ncp ) ;
78
@@ -14,6 +15,11 @@ type CreateArgs = {
1415async function create ( args : string [ ] ) : Promise < void > {
1516 let options : CreateArgs ;
1617
18+ if ( args . length && [ "--help" , "-h" ] . includes ( args [ 0 ] ) ) {
19+ help ( ) ;
20+ return ;
21+ }
22+
1723 // default .
1824 const dir = ! args . length || args [ 0 ] . match ( / ^ - / ) ? "." : args [ 0 ] ;
1925 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() {
33Usage: coderoad [options]
44
55Options:
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
1010
1111More docs at https://github.com/coderoad/coderoad-cli
1212 ` ) ;
1313}
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