MCPcopy Create free account
hub / github.com/code-pushup/cli / handler

Function handler

packages/cli/src/lib/history/history-command.ts:18–56  ·  view source on GitHub ↗
(args: unknown)

Source from the content-addressed store, hash-verified

16
17const command = 'history';
18async function handler(args: unknown) {
19 printCliCommand(command);
20
21 const currentBranch = await getCurrentBranchOrTag();
22 const { targetBranch: rawTargetBranch, ...opt } = args as HistoryCliOptions &
23 HistoryOptions;
24 const {
25 targetBranch,
26 from,
27 to,
28 maxCount,
29 onlySemverTags,
30 ...historyOptions
31 } = await normalizeHashOptions({
32 ...opt,
33 targetBranch: rawTargetBranch ?? currentBranch,
34 });
35
36 const filterOptions = { targetBranch, from, to, maxCount };
37 const results: LogResult[] = onlySemverTags
38 ? await getSemverTags(filterOptions)
39 : await getHashes(filterOptions);
40
41 try {
42 // run history logic
43 const reports = await history(
44 {
45 targetBranch,
46 ...historyOptions,
47 },
48 results.map(({ hash }) => hash),
49 );
50
51 logger.info(`Reports: ${reports.length}`);
52 } finally {
53 // go back to initial branch
54 await safeCheckout(currentBranch);
55 }
56}
57
58export function yargsHistoryCommandObject() {
59 return {

Callers

nothing calls this directly

Calls 8

getCurrentBranchOrTagFunction · 0.90
getSemverTagsFunction · 0.90
getHashesFunction · 0.90
historyFunction · 0.90
safeCheckoutFunction · 0.90
printCliCommandFunction · 0.85
normalizeHashOptionsFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected