validstart
Version:
ValidStart is a powerful and intuitive command-line interface (CLI) tool meticulously crafted to streamline the project setup process.
18 lines (17 loc) • 959 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.scaffoldCLIToolPython = scaffoldCLIToolPython;
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const chalk_1 = __importDefault(require("chalk"));
;
async function scaffoldCLIToolPython({ projectName }) {
const projectPath = path_1.default.resolve(process.cwd(), projectName);
await fs_extra_1.default.mkdirp(projectPath);
const code = `import click\n\n@click.command()\ndef hello():\n click.echo("Hello from Python CLI!")\n\nif __name__ == "__main__":\n hello()\n`;
await fs_extra_1.default.writeFile(path_1.default.join(projectPath, "main.py"), code);
console.log(chalk_1.default.green(`✅ Python CLI tool '${projectName}' created with Click.`));
}