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

refactor help#18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfix/help
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor help
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 1, 2020
commit17bdfc093edb4a6f8b389ce490fb26ee06a0cb19
7 changes: 1 addition & 6 deletionssrc/build.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,13 +29,8 @@ type BuildArgs = {
async function build(args: string[]) {
let options: BuildArgs;

if (args.length && ["--help", "-h"].includes(args[0])) {
help();
return;
}

try {
// default .
//dir -default .
const dir = args[0].match(/^-/) ? "." : args[0];
// -m --markdown - default TUTORIAL.md
const markdown =
Expand Down
10 changes: 9 additions & 1 deletionsrc/cli.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import "./utils/logs";
import build from "./build";
import create from "./create";
import help from "./help";
import{help, create as createHelp, build as buildHelp } from "./help";

export async function cli(rawArgs: string[]): Promise<void> {
const command: string = rawArgs[2];
Expand All@@ -15,10 +15,18 @@ export async function cli(rawArgs: string[]): Promise<void> {
return;

case "build":
if (args.length && ["--help", "-h"].includes(args[0])) {
buildHelp();
return;
}
build(args);
break;

case "create":
if (args.length && ["--help", "-h"].includes(args[0])) {
createHelp();
return;
}
create(args);
break;

Expand Down
9 changes: 3 additions & 6 deletionssrc/create.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,14 +15,11 @@ type CreateArgs = {
async function create(args: string[]): Promise<void> {
let options: CreateArgs;

if (args.length && ["--help", "-h"].includes(args[0])) {
help();
return;
}

// default .
// dir - default .
const dir = !args.length || args[0].match(/^-/) ? "." : args[0];
// lang - default js
const lang = getArg(args, { name: "lang", alias: "l" }) || "js";
// testRunner - default mocha
const testRunner =
getArg(args, { name: "testRunner", alias: "t" }) || "mocha";

Expand Down
2 changes: 1 addition & 1 deletionsrc/help.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
exportdefaultfunction help() {
export function help() {
console.log(`
Usage: coderoad [options]

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp