optimizeit
Version:
OptimizeIt is a command-line tool that automatically optimizes source code for performance and readability, supporting multiple programming languages and configurable settings.
19 lines (18 loc) • 607 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Handles the file names passed as arguments.
*
* @param { string[] } args - The arguments passed to the CLI.
* @returns { string[] } The file names.
*/
function handleFileNames(args) {
const stopIndex = args.findIndex((arg) => arg.startsWith('-'));
const fileNames = stopIndex === -1 ? args : args.slice(0, stopIndex);
if (fileNames.length === 0) {
console.error('Please provide a file name as an argument.');
process.exit(1);
}
return fileNames;
}
exports.default = handleFileNames;