Skip to content

Commit

Permalink
Merge pull request #170 from sol-eng/reorg-package-manager-order
Browse files Browse the repository at this point in the history
Change the flow of package manager and update wording
  • Loading branch information
tnederlof authored May 12, 2023
2 parents fc8d95a + ee8e3f7 commit 7207f17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
12 changes: 3 additions & 9 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,16 @@ func newSetup(setupOpts setupOpts) error {
if err != nil {
return fmt.Errorf("%w.\nTo return to this step in the setup process use \"wbi setup --step packagemanager\"", err)
}
if packageManagerChoice {
if packageManagerChoice == "Posit Package Manager" {
err = packagemanager.InteractivePackageManagerPrompts(osType)
if err != nil {
return fmt.Errorf("%w.\nTo return to this step in the setup process use \"wbi setup --step packagemanager\"", err)
}
} else {
publicPackageManagerChoice, err := packagemanager.PromptPublicPackageManagerChoice()
} else if packageManagerChoice == "Posit Public Package Manager" {
err = packagemanager.VerifyAndBuildPublicPackageManager(osType)
if err != nil {
return fmt.Errorf("%w.\nTo return to this step in the setup process use \"wbi setup --step packagemanager\"", err)
}
if publicPackageManagerChoice {
err = packagemanager.VerifyAndBuildPublicPackageManager(osType)
if err != nil {
return fmt.Errorf("%w.\nTo return to this step in the setup process use \"wbi setup --step packagemanager\"", err)
}
}
}
step = "connect"
}
Expand Down
2 changes: 1 addition & 1 deletion internal/connect/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// Prompt users if they wish to add a default Connect URL to Workbench
func PromptConnectChoice() (bool, error) {
name := true
messageText := "Would you like to provide a default Connect URL for Workbench?"
messageText := "Would you like to provide a default Connect URL for Workbench? You will need connectivity to the Connect server to use this option."
prompt := &survey.Confirm{
Message: messageText,
}
Expand Down
18 changes: 10 additions & 8 deletions internal/packagemanager/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ import (
)

// Prompt users if they wish to add a default Posit Package Manager URL to Workbench
func PromptPackageManagerChoice() (bool, error) {
name := true
messageText := "Would you like to setup Posit Package Manager as the default R and/or Python repo in Workbench? You will need connectivity to the Package Manager server to use this option."
prompt := &survey.Confirm{
func PromptPackageManagerChoice() (string, error) {
choice := ""
messageText := "Would you like to setup Posit Package Manager or Posit Public Package Manager as the default R and/or Python repo for Workbench? You will need connectivity to the Package Manager server to use this option."
prompt := &survey.Select{
Message: messageText,
Options: []string{"Posit Package Manager", "Posit Public Package Manager", "Skip"},
Default: "Posit Public Package Manager",
}
err := survey.AskOne(prompt, &name)
err := survey.AskOne(prompt, &choice)
if err != nil {
return false, errors.New("there was an issue with the Posit Package Manager choice prompt")
return "", errors.New("there was an issue with the Posit Package Manager choice prompt")
}
log.Info(messageText)
log.Info(fmt.Sprintf("%v", name))
return name, nil
log.Info(fmt.Sprintf("%v", choice))
return choice, nil
}

func InteractivePackageManagerPrompts(osType config.OperatingSystem) error {
Expand Down

0 comments on commit 7207f17

Please sign in to comment.