MCPcopy Create free account
hub / github.com/angular/dev-infra / builder

Function builder

ng-dev/commit-message/validate-file/cli.ts:22–51  ·  view source on GitHub ↗

Builds the command.

(argv: Argv)

Source from the content-addressed store, hash-verified

20
21/** Builds the command. */
22function builder(argv: Argv) {
23 return argv
24 .option('file', {
25 type: 'string',
26 conflicts: ['file-env-variable'],
27 description: 'The path of the commit message file.',
28 })
29 .option('file-env-variable' as 'fileEnvVariable', {
30 type: 'string',
31 conflicts: ['file'],
32 description: 'The key of the environment variable for the path of the commit message file.',
33 coerce: (arg: string | undefined) => {
34 if (arg === undefined) {
35 return arg;
36 }
37 const file = process.env[arg];
38 if (!file) {
39 throw new Error(`Provided environment variable "${arg}" was not found.`);
40 }
41 return file;
42 },
43 })
44 .option('error', {
45 type: 'boolean',
46 description:
47 'Whether invalid commit messages should be treated as failures rather than a warning',
48 default: null,
49 defaultDescription: '`True` on CI or can be enabled through ng-dev user-config.',
50 });
51}
52
53/** Handles the command. */
54async function handler({error, file, fileEnvVariable}: Arguments<ValidateFileOptions>) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected