feat: add script inputs

This commit is contained in:
veganbeef
2025-06-26 10:07:14 -07:00
parent 9f5d80fddd
commit 2b85800ba7
3 changed files with 212 additions and 144 deletions

View File

@@ -2,7 +2,30 @@
import { init } from './init.js';
init().catch((err) => {
// Parse command line arguments
const args = process.argv.slice(2);
let projectName = null;
let autoAcceptDefaults = false;
// Check for -y flag
const yIndex = args.indexOf('-y');
if (yIndex !== -1) {
autoAcceptDefaults = true;
args.splice(yIndex, 1); // Remove -y from args
}
// If there's a remaining argument, it's the project name
if (args.length > 0) {
projectName = args[0];
}
// If -y is used without project name, we still need to ask for project name
if (autoAcceptDefaults && !projectName) {
// We'll handle this case in the init function by asking only for project name
autoAcceptDefaults = false;
}
init(projectName, autoAcceptDefaults).catch((err) => {
console.error('Error:', err);
process.exit(1);
});