mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-18 17:09:47 -05:00
Revert "Merge pull request #15 from neynarxyz/shreyas-formatting"
This reverts commitb1fdfc19a9, reversing changes made tob9e2087bd8.
This commit is contained in:
60
bin/index.js
60
bin/index.js
@@ -15,48 +15,48 @@ if (yIndex !== -1) {
|
||||
args.splice(yIndex, 1); // Remove -y from args
|
||||
}
|
||||
|
||||
// Parse other arguments
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const arg = args[i];
|
||||
|
||||
if (arg === '-p' || arg === '--project') {
|
||||
if (i + 1 < args.length) {
|
||||
projectName = args[i + 1];
|
||||
if (projectName.startsWith('-')) {
|
||||
console.error('Error: Project name cannot start with a dash (-)');
|
||||
// Parse other arguments
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const arg = args[i];
|
||||
|
||||
if (arg === '-p' || arg === '--project') {
|
||||
if (i + 1 < args.length) {
|
||||
projectName = args[i + 1];
|
||||
if (projectName.startsWith('-')) {
|
||||
console.error('Error: Project name cannot start with a dash (-)');
|
||||
process.exit(1);
|
||||
}
|
||||
args.splice(i, 2); // Remove both the flag and its value
|
||||
i--; // Adjust index since we removed 2 elements
|
||||
} else {
|
||||
console.error('Error: -p/--project requires a project name');
|
||||
process.exit(1);
|
||||
}
|
||||
args.splice(i, 2); // Remove both the flag and its value
|
||||
i--; // Adjust index since we removed 2 elements
|
||||
} else {
|
||||
console.error('Error: -p/--project requires a project name');
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (arg === '-k' || arg === '--api-key') {
|
||||
if (i + 1 < args.length) {
|
||||
apiKey = args[i + 1];
|
||||
if (apiKey.startsWith('-')) {
|
||||
console.error('Error: API key cannot start with a dash (-)');
|
||||
} else if (arg === '-k' || arg === '--api-key') {
|
||||
if (i + 1 < args.length) {
|
||||
apiKey = args[i + 1];
|
||||
if (apiKey.startsWith('-')) {
|
||||
console.error('Error: API key cannot start with a dash (-)');
|
||||
process.exit(1);
|
||||
}
|
||||
args.splice(i, 2); // Remove both the flag and its value
|
||||
i--; // Adjust index since we removed 2 elements
|
||||
} else {
|
||||
console.error('Error: -k/--api-key requires an API key');
|
||||
process.exit(1);
|
||||
}
|
||||
args.splice(i, 2); // Remove both the flag and its value
|
||||
i--; // Adjust index since we removed 2 elements
|
||||
} else {
|
||||
console.error('Error: -k/--api-key requires an API key');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Validate that if -y is used, a project name must be provided
|
||||
if (autoAcceptDefaults && !projectName) {
|
||||
console.error(
|
||||
'Error: -y flag requires a project name. Use -p/--project to specify the project name.',
|
||||
);
|
||||
console.error('Error: -y flag requires a project name. Use -p/--project to specify the project name.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
init(projectName, autoAcceptDefaults, apiKey).catch(err => {
|
||||
init(projectName, autoAcceptDefaults, apiKey).catch((err) => {
|
||||
console.error('Error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user