diff --git a/internal/pkg/cli/env_list.go b/internal/pkg/cli/env_list.go index 3ffbc2539fe..39e076762e5 100644 --- a/internal/pkg/cli/env_list.go +++ b/internal/pkg/cli/env_list.go @@ -48,14 +48,6 @@ func newListEnvOpts(vars listEnvVars) (*listEnvOpts, error) { }, nil } -// Validate returns an error if the values passed by flags are invalid. -func (o *listEnvOpts) Validate() error { - if o.AppName() == "" { - return fmt.Errorf("no application found: run %s or %s into your workspace please", color.HighlightCode("app init"), color.HighlightCode("cd")) - } - return nil -} - // Ask asks for fields that are required but not passed in. func (o *listEnvOpts) Ask() error { if o.AppName() != "" { @@ -135,9 +127,6 @@ func BuildEnvListCmd() *cobra.Command { if err != nil { return err } - if err := opts.Validate(); err != nil { - return err - } if err := opts.Ask(); err != nil { return err } diff --git a/internal/pkg/cli/env_list_test.go b/internal/pkg/cli/env_list_test.go index 2fbeff2a147..f4ae9dcfa5b 100644 --- a/internal/pkg/cli/env_list_test.go +++ b/internal/pkg/cli/env_list_test.go @@ -15,44 +15,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestListEnvOpts_Validate(t *testing.T) { - testCases := map[string]struct { - inAppName string - - wantedErr string - }{ - "valid app": { - inAppName: "phonetool", - }, - "invalid app": { - inAppName: "", - - wantedErr: fmt.Sprint("no application found: run `app init` or `cd` into your workspace please"), - }, - } - - for name, tc := range testCases { - t.Run(name, func(t *testing.T) { - // GIVEN - opts := &initEnvOpts{ - initEnvVars: initEnvVars{ - GlobalOpts: &GlobalOpts{appName: tc.inAppName}, - }, - } - - // WHEN - err := opts.Validate() - - // THEN - if tc.wantedErr != "" { - require.EqualError(t, err, tc.wantedErr) - } else { - require.Nil(t, err) - } - }) - } -} - func TestEnvList_Ask(t *testing.T) { testCases := map[string]struct { inputApp string