INNER CODE UNIT · TypeScript
spaceTextPrinted
vinta/pangu.js · src/node/cli.ts:46
function spaceTextPrinted(text: string | undefined) {
if (typeof text === 'string') {
console.log(pangu.spaceText(text));
} else {
console.log(usage);
process.exitCode = 1;
}
}
// An empty string is what -f "$EMPTY_VAR" expands to, so it counts as a missing path rather than a file to open
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;