-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
sharedDangerfileArgs.ts
60 lines (57 loc) · 2.58 KB
/
sharedDangerfileArgs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Command } from "commander"
import chalk from "chalk"
process.on("unhandledRejection", function (reason: string, _p: any) {
console.log(chalk.red("Error: "), reason)
process.exitCode = 1
})
export interface SharedCLI extends Command {
/** Should we be posting as much info as possible? */
verbose: boolean
/** Output to STDOUT instead of leaving a comment */
textOnly: boolean
/** Use a custom file for the CI provider instead of a built-in one */
externalCiProvider?: string
/** Where is the file? can be local or remote GH url */
dangerfile?: string
/** The Danger run ID, so you can have many runs */
id?: string
/** Run in a repl? */
repl?: string
/** Use a custom file for the CI provider instead of a built-in one */
process?: string
/** Use a URL to send in the DSL instead of just STDIN */
passURLForDSL?: boolean
/** Fail if there are fails in the danger report */
failOnErrors: boolean
/** Use GitHub Checks */
useGithubChecks: boolean
/** Ignore inline-comments that are in lines which were not changed */
ignoreOutOfDiffComments: boolean
/** Makes Danger post a new comment instead of editing its previous one */
newComment?: boolean
/** Removes all previous comment and create a new one in the end of the list */
removePreviousComments?: boolean
/** Output JSON to STDOUT */
outputJSON: boolean
}
export default (command: any) =>
command
.option("-v, --verbose", "Verbose output of files", false)
.option("-t, --text-only", "Provide an STDOUT only interface, Danger will not post to your PR", false)
.option(
"-d, --dangerfile [filePath | remote url]",
"Specify a custom dangerfile path, remote urls only work with github"
)
.option("-i, --id [danger_id]", "Specify a unique Danger ID for the Danger run")
.option("-c, --external-ci-provider [modulePath]", "Specify custom CI provider")
.option("-p, --process [command]", "[dev] Runs a custom sub-process instead of the Danger JS runtime")
.option("-u, --passURLForDSL", "[dev] Use a custom URL to send the Danger DSL into the sub-process")
.option("-f, --failOnErrors", "Fail if there are fails in the danger report", false)
.option("--use-github-checks", "Use GitHub Checks", false)
.option("--ignoreOutOfDiffComments", "Ignore inline-comments that are in lines which were not changed", false)
.option("--newComment", "Makes Danger post a new comment instead of editing its previous one", false)
.option(
"--removePreviousComments",
"Removes all previous comment and create a new one in the end of the list",
false
)