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

Function handler

ng-dev/commit-message/restore-commit-message/cli.ts:36–57  ·  view source on GitHub ↗

Handles the command.

({fileEnvVariable, file, source}: Arguments<RestoreCommitMessageOptions>)

Source from the content-addressed store, hash-verified

34
35/** Handles the command. */
36async function handler({fileEnvVariable, file, source}: Arguments<RestoreCommitMessageOptions>) {
37 // File and source are provided as command line parameters
38 if (file !== undefined) {
39 restoreCommitMessage(file, source as CommitMsgSource);
40 return;
41 }
42
43 // File and source are provided as values held in an environment variable.
44 if (fileEnvVariable !== undefined) {
45 const [fileFromEnv, sourceFromEnv] = (process.env[fileEnvVariable!] || '').split(' ');
46 if (!fileFromEnv) {
47 throw new Error(`Provided environment variable "${fileEnvVariable}" was not found.`);
48 }
49 restoreCommitMessage(fileFromEnv, sourceFromEnv as CommitMsgSource);
50 return;
51 }
52
53 throw new Error(
54 'No file path and commit message source provide. Provide values via positional command ' +
55 'arguments, or via the --file-env-variable flag',
56 );
57}
58
59/** yargs command module describing the command. */
60export const RestoreCommitMessageModule: CommandModule<{}, RestoreCommitMessageOptions> = {

Callers

nothing calls this directly

Calls 1

restoreCommitMessageFunction · 0.85

Tested by

no test coverage detected