MCPcopy Index your code
hub / github.com/commitizen/cz-cli / parse

Function parse

src/cli/parsers/git-cz.js:11–51  ·  view source on GitHub ↗

* Strip message declaration from git arguments

(rawGitArgs)

Source from the content-addressed store, hash-verified

9 * Strip message declaration from git arguments
10 */
11function parse (rawGitArgs) {
12 let result = [];
13 let skipNext = false;
14
15 for (const arg of rawGitArgs) {
16 let match;
17
18 if (skipNext) {
19 skipNext = false;
20 continue;
21 }
22
23 match = reShortMessage.exec(arg);
24
25 if (match) {
26 if (match[1]) {
27 result.push(`-${match[1]}`);
28 }
29
30 if (!match[2]) {
31 skipNext = true;
32 }
33
34 continue;
35 }
36
37 match = reLongMessage.exec(arg);
38
39 if (match) {
40 if (!match[1]) {
41 skipNext = true;
42 }
43
44 continue;
45 }
46
47 result.push(arg);
48 }
49
50 return result;
51}

Callers 3

bootstrapFunction · 0.50
gitCzFunction · 0.50
readConfigContentFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected