-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
35 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: wessberg | ||
patreon: wessberg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import commander from "commander"; | ||
|
||
commander.parse(process.argv); | ||
|
||
// Show help if no arguments are given | ||
if (commander.args.length === 0) { | ||
commander.help(text => { | ||
return `Welcome to Scaffold!\n\n` + text; | ||
}); | ||
const lastArgv = process.argv.slice(-1)[0]; | ||
if (lastArgv.endsWith("scaffold")) { | ||
// Show help if no arguments are given | ||
if (commander.args.length === 0) { | ||
commander.help(text => { | ||
return `Welcome to Scaffold!\n\n` + text; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
export const SHARED_OPTIONS = { | ||
config: { | ||
shortHand: "c", | ||
type: "string" as "string", | ||
type: "string", | ||
description: "An (optional) path to the scaffold config to use" | ||
}, | ||
debug: { | ||
shortHand: "d", | ||
type: "boolean" as "boolean", | ||
type: "boolean", | ||
description: "Whether to print debug information" | ||
}, | ||
verbose: { | ||
shortHand: "v", | ||
type: "boolean" as "boolean", | ||
type: "boolean", | ||
description: "Whether to print verbose information" | ||
}, | ||
silent: { | ||
shortHand: "s", | ||
type: "boolean" as "boolean", | ||
type: "boolean", | ||
description: "Whether to not print anything" | ||
}, | ||
yes: { | ||
shortHand: "y", | ||
type: "boolean" as "boolean", | ||
type: "boolean", | ||
description: "Whether or not to auto-select 'yes' for all prompts" | ||
} | ||
}; | ||
} as const; |
9 changes: 6 additions & 3 deletions
9
src/cli/task/generate-task-options/sanitized-shared-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import {SHARED_OPTIONS} from "../../command/shared/shared-options"; | ||
|
||
export type SanitizedSharedOptions<T = typeof SHARED_OPTIONS> = { | ||
// @ts-ignore | ||
[Key in keyof T]: T[Key]["type"] extends "boolean" ? boolean : T[Key]["type"] extends "number" ? number : string; | ||
export type SanitizedSharedOptions = { | ||
[Key in keyof typeof SHARED_OPTIONS]: typeof SHARED_OPTIONS[Key]["type"] extends "boolean" | ||
? boolean | ||
: typeof SHARED_OPTIONS[Key]["type"] extends "number" | ||
? number | ||
: string; | ||
}; |
8 changes: 1 addition & 7 deletions
8
src/cli/task/generate-task-options/select-log-level/select-log-level-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
import {SHARED_OPTIONS} from "../../../command/shared/shared-options"; | ||
import {SanitizedSharedOptions} from "../sanitized-shared-options"; | ||
|
||
export type SelectLogLevelOptions< | ||
T = Pick< | ||
typeof SHARED_OPTIONS, | ||
{[Key in keyof typeof SHARED_OPTIONS]: (typeof SHARED_OPTIONS[Key]["type"] extends "boolean" ? Key : never)}[keyof typeof SHARED_OPTIONS] | ||
> | ||
> = SanitizedSharedOptions<T>; | ||
export type SelectLogLevelOptions = SanitizedSharedOptions; |