Skip to content

Commit 9338859

Browse files
committed
Improve performance of org/project ID selection and debug logs
1 parent bb3fda0 commit 9338859

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

commands/init.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func runInitCommand(
141141
if err != nil {
142142
return err
143143
}
144+
if org != nil {
145+
debugLog("Selected organization: %s (%s)", org.Label, org.ID)
146+
if initOptions.ProjectID != "" {
147+
debugLog("Selected project: %s", initOptions.ProjectID)
148+
}
149+
}
144150

145151
// Ask the user if they want to configure their project using AI (if not explicitly set).
146152
if !cmd.Flags().Changed("ai") && isInteractive && (org == nil || org.Type == api.OrgTypeFlexible) {
@@ -283,16 +289,17 @@ func getCurrentOrganizationAndProjectID(ctx context.Context, wrapper *legacy.CLI
283289
wrapper.Stderr = nil
284290
wrapper.Stdout = buf
285291
wrapper.Stdin = nil
286-
if err := wrapper.Exec(ctx, "organization:info", "id", "--no-interaction"); err != nil {
292+
293+
if err := wrapper.Exec(ctx, "project:info", "id", "--no-interaction"); err != nil {
287294
return
288295
}
289-
orgID = strings.TrimSpace(buf.String())
296+
projectID = strings.TrimSpace(buf.String())
290297
buf.Reset()
291298

292-
if err := wrapper.Exec(ctx, "project:info", "id", "--no-interaction"); err != nil {
299+
if err := wrapper.Exec(ctx, "organization:info", "id", "--no-interaction"); err != nil {
293300
return
294301
}
295-
projectID = strings.TrimSpace(buf.String())
302+
orgID = strings.TrimSpace(buf.String())
296303

297304
return
298305
}

0 commit comments

Comments
 (0)