Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36fdd61

Browse files
committed
add cli arg docs
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent60367b2 commit36fdd61

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

‎src/build.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { parse } from "./utils/parse";
77
import{getArg}from"./utils/args";
88
import{getCommits,CommitLogObject}from"./utils/commits";
99
import{validateSchema}from"./utils/validate";
10+
import{buildashelp}from"./help";
1011
import*asTfrom"../typings/tutorial";
1112

1213
constwrite=util.promisify(fs.writeFile);
@@ -27,6 +28,12 @@ type BuildArgs = {
2728

2829
asyncfunctionbuild(args:string[]){
2930
letoptions:BuildArgs;
31+
32+
if(args.length&&["--help","-h"].includes(args[0])){
33+
help();
34+
return;
35+
}
36+
3037
try{
3138
// default .
3239
constdir=args[0].match(/^-/) ?"." :args[0];

‎src/create.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import ncp from "ncp";
22
import*aspathfrom"path";
33
import{promisify}from"util";
44
import{getArg}from"./utils/args";
5+
import{createashelp}from"./help";
56

67
constcopy=promisify(ncp);
78

@@ -14,6 +15,11 @@ type CreateArgs = {
1415
asyncfunctioncreate(args:string[]):Promise<void>{
1516
letoptions:CreateArgs;
1617

18+
if(args.length&&["--help","-h"].includes(args[0])){
19+
help();
20+
return;
21+
}
22+
1723
// default .
1824
constdir=!args.length||args[0].match(/^-/) ?"." :args[0];
1925
constlang=getArg(args,{name:"lang",alias:"l"})||"js";

‎src/help.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,38 @@ export default function help() {
33
Usage: coderoad [options]
44
55
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
1010
1111
More docs at https://github.com/coderoad/coderoad-cli
1212
`);
1313
}
14+
15+
exportfunctioncreate(){
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+
exportfunctionbuild(){
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+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp