INNER CODE UNIT · TypeScript
formatCommandError
niklashigi/apk-mitm · src/cli.ts:216
function formatCommandError(error: string, { tmpDir }: { tmpDir: string }) {
return (
error
// Replace mentions of the (sometimes very long) temporary directory path
.replace(new RegExp(tmpDir, 'g'), chalk`{bold <tmp_dir>}`)
// Highlight (usually relevant) warning lines in Apktool output
.replace(/^W: .+$/gm, line => chalk`{yellow ${line}}`)
// De-emphasize Apktool info lines
.replace(/^I: .+$/gm, line => chalk`{dim ${line}}`)
// De-emphasize (not very helpful) Apktool "could not exec" error message
.replace(
/^.+brut\.common\.BrutException: could not exec.+$/gm,
line => chalk`{dim ${line}}`,
)
)
}
function showHelp() {