@@ -40,14 +40,22 @@ const initProject = async ({ organizationId, projectId, projectName } = {}) => {
40
40
log('You must login first')
41
41
await loginCommand();
42
42
}
43
+
43
44
let answers = {};
44
45
45
- if (organizationId && projectId && projectName) {
46
- answers = {
47
- project: { id: projectId, name: projectName },
48
- organization: { id: organizationId },
49
- start: 'existing'
46
+ if (!organizationId && !projectId && !projectName) {
47
+ answers = await inquirer.prompt(questionsInitProject)
48
+ if (answers.override === false) {
49
+ process.exit(1)
50
50
}
51
+ } else {
52
+ answers.start = 'existing';
53
+ answers.project = {};
54
+ answers.organization = {};
55
+
56
+ answers.organization.id = organizationId ?? (await inquirer.prompt(questionsInitProject[2])).organization;
57
+ answers.project.name = projectName ?? (await inquirer.prompt(questionsInitProject[3])).project;
58
+ answers.project.id = projectId ?? (await inquirer.prompt(questionsInitProject[4])).id;
51
59
52
60
try {
53
61
await projectsGet({ projectId, parseOutput: false });
@@ -60,15 +68,8 @@ const initProject = async ({ organizationId, projectId, projectName } = {}) => {
60
68
throw e;
61
69
}
62
70
}
63
-
64
- } else {
65
- answers = await inquirer.prompt(questionsInitProject)
66
- if (answers.override === false) {
67
- process.exit(1)
68
- }
69
71
}
70
72
71
-
72
73
if (answers.start === 'new') {
73
74
response = await projectsCreate({
74
75
projectId: answers.id,
@@ -170,7 +171,6 @@ const initFunction = async () => {
170
171
}
171
172
172
173
173
-
174
174
fs.mkdirSync(functionDir, "777");
175
175
fs.mkdirSync(templatesDir, "777");
176
176
0 commit comments