Skip to content

Commit

Permalink
fix: code command runtime error on select workspace (#783)
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Brecic <[email protected]>
  • Loading branch information
lbrecic authored Jul 17, 2024
1 parent 24c07a9 commit 767755a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/cmd/workspace/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var CodeCmd = &cobra.Command{
}

if len(args) == 0 {
workspaceList, res, err := apiClient.WorkspaceAPI.ListWorkspaces(ctx).Execute()
workspaceList, res, err := apiClient.WorkspaceAPI.ListWorkspaces(ctx).Verbose(true).Execute()
if err != nil {
log.Fatal(apiclient_util.HandleErrorResponse(res, err))
}
Expand Down Expand Up @@ -99,13 +99,15 @@ var CodeCmd = &cobra.Command{
views.RenderInfoMessage(fmt.Sprintf("Opening the project '%s' from workspace '%s' in %s", projectName, *workspace.Name, ideName))

providerMetadata := ""
for _, project := range workspace.Info.Projects {
if *project.Name == projectName {
if project.ProviderMetadata == nil {
log.Fatal(errors.New("project provider metadata is missing"))
if workspace.Info != nil {
for _, project := range workspace.Info.Projects {
if *project.Name == projectName {
if project.ProviderMetadata == nil {
log.Fatal(errors.New("project provider metadata is missing"))
}
providerMetadata = *project.ProviderMetadata
break
}
providerMetadata = *project.ProviderMetadata
break
}
}

Expand Down

0 comments on commit 767755a

Please sign in to comment.