MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / selectProject

Function selectProject

pkg/cmd/runbook/run/run.go:552–572  ·  view source on GitHub ↗
(octopus *octopusApiClient.Client, f factory.Factory, projectName string)

Source from the content-addressed store, hash-verified

550}
551
552func selectProject(octopus *octopusApiClient.Client, f factory.Factory, projectName string) (*projects.Project, error) {
553 if projectName == "" {
554 if f.IsPromptEnabled() {
555 selectedProject, err := selectors.Project("Select project", octopus, f.Ask)
556 if err != nil {
557 return nil, err
558 }
559 return selectedProject, nil
560 } else {
561 // Project name not provided and not asking questions so error out
562 return nil, errors.New("project must be specified")
563 }
564 } else { // project name is already provided, fetch the object because it's needed for further questions
565 selectedProject, err := selectors.FindProject(octopus, projectName)
566 if err != nil {
567 return nil, err
568 }
569
570 return selectedProject, nil
571 }
572}
573
574// shouldAskAdvancedOptions determines if we should prompt the user to change advanced options.
575// Returns true if the user wants to change options, false otherwise.

Callers 1

runbookRunFunction · 0.85

Calls 3

ProjectFunction · 0.92
FindProjectFunction · 0.92
IsPromptEnabledMethod · 0.65

Tested by

no test coverage detected