INNER CODE UNIT · TypeScript
spaceFilePrinted
vinta/pangu.js · src/node/cli.ts:56
function spaceFilePrinted(path: string | undefined) {
if (path) {
// File mode only does spacing: no newline appended, the file's own EOF newlines (or lack of one) pass through untouched
process.stdout.write(pangu.spaceFileSync(path));
} else {
console.error('pangu: error: argument --file: expected a file path');
console.log(usage);
process.exitCode = 1;
}
}
function checkSpacing(text: string | undefined) {
if (typeof text === 'string') {
const hasProperSpacing = pangu.hasProperSpacing(text);
if (!hasProperSpacing) {
// Print the corrected version to stderr so a failing -c is debuggable. stdout stays empty, so -c composes in a pipeline
console.error(`Corrected: ${pangu.spaceText(text)}`);
}