Yargs command handler for printing release information.
(argv: Arguments<ReleaseInfoOptions>)
| 45 | |
| 46 | /** Yargs command handler for printing release information. */ |
| 47 | async function handler(argv: Arguments<ReleaseInfoOptions>) { |
| 48 | const config = await getConfig(); |
| 49 | assertValidReleaseConfig(config); |
| 50 | |
| 51 | // If JSON output is requested, print the information as JSON to stdout. |
| 52 | if (argv.json) { |
| 53 | process.stdout.write(JSON.stringify(<ReleaseInfoJsonStdout>config.release, null, 2)); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | const git = await GitClient.get(); |
| 58 | const nextBranchName = getNextBranchName(git.config.github); |
| 59 | const repo: ReleaseRepoWithApi = {api: git.github, ...git.remoteConfig, nextBranchName}; |
| 60 | const releaseTrains = await ActiveReleaseTrains.fetch(repo); |
| 61 | |
| 62 | // Print the active release trains. |
| 63 | await printActiveReleaseTrains(releaseTrains, config.release); |
| 64 | } |
| 65 | |
| 66 | /** CLI command module for retrieving release information. */ |
| 67 | export const ReleaseInfoCommandModule: CommandModule<{}, ReleaseInfoOptions> = { |
nothing calls this directly
no test coverage detected