UNPKG

legal-markdown-js

Version:

Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version

36 lines 1.3 kB
/** * @fileoverview Output filename input prompt for Interactive CLI */ import { input } from '@inquirer/prompts'; import * as path from 'path'; /** * Prompt user for output filename (without extension) */ export async function promptOutputFilename(inputFile) { const inputBasename = path.basename(inputFile, path.extname(inputFile)); const filename = await input({ message: 'Enter output filename (without extension):', default: inputBasename, validate: (value) => { const trimmed = value.trim(); if (!trimmed) { return 'Filename is required'; } // Check for invalid characters (basic validation) const invalidChars = /[<>:"/\\|?*]/; if (invalidChars.test(trimmed)) { return 'Filename contains invalid characters'; } // Check if it starts/ends with spaces or dots if (trimmed !== value) { return 'Filename cannot start or end with spaces'; } if (trimmed.startsWith('.') || trimmed.endsWith('.')) { return 'Filename cannot start or end with dots'; } return true; }, }); return filename.trim(); } //# sourceMappingURL=filename.js.map