(args: unknown)
| 16 | |
| 17 | const command = 'history'; |
| 18 | async 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 | |
| 58 | export function yargsHistoryCommandObject() { |
| 59 | return { |
nothing calls this directly
no test coverage detected