Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package cmd
import (
"context"
"fmt"
"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
"io"
"mvdan.cc/sh/v3/expand"
"os"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
"mvdan.cc/sh/v3/expand"

"github.com/loft-sh/devspace/pkg/devspace/config"
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
Expand Down
9 changes: 5 additions & 4 deletions pkg/devspace/config/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package loader
import (
"context"
"fmt"
"github.com/loft-sh/devspace/pkg/devspace/context/values"
"github.com/loft-sh/devspace/pkg/util/encoding"
"github.com/loft-sh/devspace/pkg/util/yamlutil"
"io/ioutil"
"mvdan.cc/sh/v3/expand"
"os"
"path/filepath"
"regexp"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/context/values"
"github.com/loft-sh/devspace/pkg/util/encoding"
"github.com/loft-sh/devspace/pkg/util/yamlutil"
"mvdan.cc/sh/v3/expand"

"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
"github.com/loft-sh/devspace/pkg/devspace/config/remotecache"
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
Expand Down
8 changes: 3 additions & 5 deletions pkg/devspace/config/loader/variable/undefined_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package variable
import (
"context"
"fmt"
"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
"github.com/sirupsen/logrus"
"os"
"strconv"

"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
"github.com/sirupsen/logrus"

"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/devspace/pkg/util/survey"
Expand Down Expand Up @@ -93,9 +94,6 @@ func askQuestion(variable *latest.Variable, log log.Logger) (string, error) {

if len(variable.Options) > 0 {
params.Options = variable.Options
if variable.Default == nil {
params.DefaultValue = params.Options[0]
}
} else if variable.ValidationPattern != "" {
params.ValidationRegexPattern = variable.ValidationPattern

Expand Down
6 changes: 4 additions & 2 deletions pkg/util/log/stream_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,10 @@ func (s *StreamLogger) Question(params *survey.QuestionOptions) (string, error)
s.m.Lock()
defer s.m.Unlock()

if !s.isTerminal {
return "", fmt.Errorf("cannot ask question '%s' because you are not currently using a terminal", params.Question)
if !s.isTerminal && (params.DefaultValue == "" || params.DefaultValue == "<nil>") {
return "", fmt.Errorf("cannot ask question '%s' because currently you're not using devspace in a terminal and default value is also not provided", params.Question)
} else if !s.isTerminal && params.DefaultValue != "" {
return params.DefaultValue, nil
}

// Check if we can ask the question
Expand Down