Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
use mitchellh/cli for prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Feb 27, 2019
1 parent 9b35988 commit 7f23457
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pkg/specs/replicatedapp/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ import (
"path/filepath"
"strings"

"github.com/replicatedhq/ship/pkg/specs/apptype"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/mitchellh/cli"
"github.com/pkg/errors"
"github.com/spf13/afero"
"github.com/spf13/viper"
yaml "gopkg.in/yaml.v2"

"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/constants"
"github.com/replicatedhq/ship/pkg/helpers/flags"
"github.com/replicatedhq/ship/pkg/specs/apptype"
"github.com/replicatedhq/ship/pkg/state"
"github.com/spf13/afero"
"github.com/spf13/viper"
yaml "gopkg.in/yaml.v2"
)

type shaSummer func([]byte) string
Expand All @@ -29,6 +30,7 @@ type resolver struct {
Client *GraphQLClient
FS afero.Afero
StateManager state.Manager
UI cli.Ui
ShaSummer shaSummer
Runbook string
SetChannelName string
Expand All @@ -45,11 +47,13 @@ func NewAppResolver(
fs afero.Afero,
graphql *GraphQLClient,
stateManager state.Manager,
ui cli.Ui,
) Resolver {
return &resolver{
Logger: logger,
Client: graphql,
FS: fs,
UI: ui,
Runbook: flags.GetCurrentOrDeprecatedString(v, "runbook", "studio-file"),
SetChannelName: flags.GetCurrentOrDeprecatedString(v, "set-channel-name", "studio-channel-name"),
SetChannelIcon: flags.GetCurrentOrDeprecatedString(v, "set-channel-icon", "studio-channel-icon"),
Expand Down Expand Up @@ -169,9 +173,13 @@ func (r *resolver) resolveCloudRelease(selector *Selector) (*ShipRelease, error)
if err != nil {
if selector.InstallationID == "" {
debug.Log("event", "spec-resolve", "from", selector, "error", err)
fmt.Printf("Please enter your license to continue: ")

var input string
fmt.Scanln(&input)
input, err = r.UI.Ask("Please enter your license to continue: ")
if err != nil {
return nil, errors.Wrapf(err, "enter license from CLI")
}

selector.InstallationID = input

err = r.updateUpstream(*selector)
Expand Down

0 comments on commit 7f23457

Please sign in to comment.