@@ -81,7 +81,7 @@ var CreateCmd = &cobra.Command{
81
81
}
82
82
83
83
if len (args ) == 0 {
84
- err = processPrompting (apiClient , & workspaceName , & projects , existingWorkspaceNames , ctx )
84
+ err = processPrompting (ctx , apiClient , & workspaceName , & projects , existingWorkspaceNames )
85
85
if err != nil {
86
86
if common .IsCtrlCAbort (err ) {
87
87
return
@@ -90,7 +90,7 @@ var CreateCmd = &cobra.Command{
90
90
}
91
91
}
92
92
} else {
93
- existingProjectConfigNames , err = processCmdArguments (args , apiClient , & projects , ctx )
93
+ existingProjectConfigNames , err = processCmdArguments (ctx , args , apiClient , & projects )
94
94
if err != nil {
95
95
log .Fatal (err )
96
96
}
@@ -278,7 +278,7 @@ func getTarget(targetList []apiclient.ProviderTarget, activeProfileName string)
278
278
return target .GetTargetFromPrompt (targetList , activeProfileName , false )
279
279
}
280
280
281
- func processPrompting (apiClient * apiclient.APIClient , workspaceName * string , projects * []apiclient.CreateProjectDTO , workspaceNames []string , ctx context. Context ) error {
281
+ func processPrompting (ctx context. Context , apiClient * apiclient.APIClient , workspaceName * string , projects * []apiclient.CreateProjectDTO , workspaceNames []string ) error {
282
282
if workspace_util .CheckAnyProjectConfigurationFlagSet (projectConfigurationFlags ) || (projectConfigurationFlags .Branches != nil && len (* projectConfigurationFlags .Branches ) > 0 ) {
283
283
return errors .New ("please provide the repository URL in order to set up custom project details through the CLI" )
284
284
}
@@ -340,7 +340,7 @@ func processPrompting(apiClient *apiclient.APIClient, workspaceName *string, pro
340
340
return nil
341
341
}
342
342
343
- func processCmdArguments (repoUrls []string , apiClient * apiclient.APIClient , projects * []apiclient.CreateProjectDTO , ctx context. Context ) ([]string , error ) {
343
+ func processCmdArguments (ctx context. Context , repoUrls []string , apiClient * apiclient.APIClient , projects * []apiclient.CreateProjectDTO ) ([]string , error ) {
344
344
if len (repoUrls ) == 0 {
345
345
return nil , fmt .Errorf ("no repository URLs provided" )
346
346
}
@@ -358,15 +358,15 @@ func processCmdArguments(repoUrls []string, apiClient *apiclient.APIClient, proj
358
358
existingProjectConfigNames := []string {}
359
359
360
360
for i , repoUrl := range repoUrls {
361
- branch := ""
361
+ var branch * string
362
362
if len (* projectConfigurationFlags .Branches ) > i {
363
- branch = (* projectConfigurationFlags .Branches )[i ]
363
+ branch = & (* projectConfigurationFlags .Branches )[i ]
364
364
}
365
365
366
366
validatedUrl , err := util .GetValidatedUrl (repoUrl )
367
367
if err == nil {
368
368
// The argument is a Git URL
369
- existingProjectConfigName , err := processGitURL (ctx , validatedUrl , apiClient , projects , & branch )
369
+ existingProjectConfigName , err := processGitURL (ctx , validatedUrl , apiClient , projects , branch )
370
370
if err != nil {
371
371
return nil , err
372
372
}
@@ -407,11 +407,7 @@ func processGitURL(ctx context.Context, repoUrl string, apiClient *apiclient.API
407
407
if ! blankFlag {
408
408
projectConfig , res , err := apiClient .ProjectConfigAPI .GetDefaultProjectConfig (ctx , encodedURLParam ).Execute ()
409
409
if err == nil {
410
- b := ""
411
- if branch != nil {
412
- b = * branch
413
- }
414
- return workspace_util .AddProjectFromConfig (projectConfig , apiClient , projects , b )
410
+ return workspace_util .AddProjectFromConfig (projectConfig , apiClient , projects , branch )
415
411
}
416
412
417
413
if res .StatusCode != http .StatusNotFound {
0 commit comments