Skip to content

Commit

Permalink
changed flag plain-text to plain-text-output
Browse files Browse the repository at this point in the history
  • Loading branch information
psihachina committed Oct 20, 2022
1 parent fcc2a53 commit 0bdf028
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 30 deletions.
2 changes: 1 addition & 1 deletion examples/bastion-tunnel-monorepo/.ize/env/testnut/ize.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace = "testnut" # (required) Namespace of the project ca
terraform_version = "1.2.6" # (optional) Terraform version can be set here. 1.1.3 by default
# prefer_runtime = "" # (optional) Prefer a specific runtime. (native or docker) (default 'native')
# tag = "" # (optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.
# env = "dev" # (optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag.
# env_dir = "" # (optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
Expand Down
2 changes: 1 addition & 1 deletion examples/ecs-apps-monorepo/.ize/env/testnut/ize.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace = "testnut" # (required) Namespace of the project ca
terraform_version = "1.2.6" # (optional) Terraform version can be set here. 1.1.3 by default
# prefer_runtime = "" # (optional) Prefer a specific runtime. (native or docker) (default 'native')
# tag = "" # (optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.
# env = "dev" # (optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag.
# env_dir = "" # (optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
Expand Down
2 changes: 1 addition & 1 deletion examples/multistate-monorepo/.ize/env/testnut/ize.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace = "testnut" # (required) Namespace of the project ca
terraform_version = "1.2.6" # (optional) Terraform version can be set here. 1.1.3 by default
# prefer_runtime = "" # (optional) Prefer a specific runtime. (native or docker) (default 'native')
# tag = "" # (optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.
# env = "dev" # (optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag.
# env_dir = "" # (optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
Expand Down
2 changes: 1 addition & 1 deletion examples/sls-apps-monorepo/.ize/env/testnut/ize.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace = "testnut" # (required) Namespace of the project ca
terraform_version = "1.2.6" # (optional) Terraform version can be set here. 1.1.3 by default
# prefer_runtime = "" # (optional) Prefer a specific runtime. (native or docker) (default 'native')
# tag = "" # (optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.
# plain_text = false # (optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.
# env = "dev" # (optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag.
# env_dir = "" # (optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention.
# docker_registry = "" # (optional) Docker registry can be set here. By default it uses ECR repo with the name of the service.
Expand Down
17 changes: 9 additions & 8 deletions internal/commands/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ package commands
import (
_ "embed"
"fmt"
"os"
"path/filepath"
"strings"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/ecs"
Expand All @@ -12,10 +17,6 @@ import (
"github.com/hazelops/ize/pkg/mocks"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"os"
"path/filepath"
"strings"
"testing"
)

//go:generate mockgen -package=mocks -destination ../../pkg/mocks/mock_ecs.go github.com/aws/aws-sdk-go/service/ecs/ecsiface ECSAPI
Expand Down Expand Up @@ -91,7 +92,7 @@ func TestConsole(t *testing.T) {
},
{
name: "failed (list tasks cluster not found)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -100,7 +101,7 @@ func TestConsole(t *testing.T) {
},
{
name: "failed (list tasks any err)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -109,7 +110,7 @@ func TestConsole(t *testing.T) {
},
{
name: "failed (execute command cluster not found)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -122,7 +123,7 @@ func TestConsole(t *testing.T) {
},
{
name: "failed (execute command any err)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand Down
17 changes: 9 additions & 8 deletions internal/commands/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ package commands
import (
_ "embed"
"fmt"
"os"
"path/filepath"
"strings"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/ecs"
Expand All @@ -12,10 +17,6 @@ import (
"github.com/hazelops/ize/pkg/mocks"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"os"
"path/filepath"
"strings"
"testing"
)

//go:generate mockgen -package=mocks -destination ../../pkg/mocks/mock_ecs.go github.com/aws/aws-sdk-go/service/ecs/ecsiface ECSAPI
Expand Down Expand Up @@ -91,7 +92,7 @@ func TestExec(t *testing.T) {
},
{
name: "failed (list tasks cluster not found)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -100,7 +101,7 @@ func TestExec(t *testing.T) {
},
{
name: "failed (list tasks any err)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -109,7 +110,7 @@ func TestExec(t *testing.T) {
},
{
name: "failed (execute command cluster not found)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand All @@ -122,7 +123,7 @@ func TestExec(t *testing.T) {
},
{
name: "failed (execute command any err)",
args: []string{"console", "goblin", "--plain-text"},
args: []string{"console", "goblin", "--plain-text-output"},
env: map[string]string{"ENV": "test", "AWS_PROFILE": "test", "NAMESPACE": "dev-testnut", "AWS_REGION": "us-west-2"},
wantErr: true,
mockECSClient: func(m *mocks.MockECSAPI) {
Expand Down
13 changes: 7 additions & 6 deletions internal/commands/ize.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ package commands
import (
"bytes"
"fmt"
"os"
"path"
"runtime"
"strings"
"text/template"

"github.com/hazelops/ize/internal/config"
"github.com/hazelops/ize/internal/version"
"github.com/hazelops/ize/pkg/templates"
Expand All @@ -12,11 +18,6 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"golang.org/x/exp/slices"
"os"
"path"
"runtime"
"strings"
"text/template"
)

var izeDescTpl = templates.LongDesc(`
Expand Down Expand Up @@ -60,7 +61,7 @@ func newRootCmd(project *config.Project) *cobra.Command {

cmd.CompletionOptions.DisableDefaultCmd = true
cmd.PersistentFlags().StringP("log-level", "l", "", "set log level. Possible levels: info, debug, trace, panic, warn, error, fatal(default)")
cmd.PersistentFlags().Bool("plain-text", false, "enable plain text")
cmd.PersistentFlags().Bool("plain-text-output", false, "enable plain text output")
cmd.PersistentFlags().StringP("config-file", "c", "", "set config file name")
cmd.PersistentFlags().StringP("env", "e", "", "(required) set environment name (overrides value set in IZE_ENV / ENV if any of them are set)")
cmd.PersistentFlags().StringP("aws-profile", "p", "", "(required) set AWS profile (overrides value in ize.toml and IZE_AWS_PROFILE / AWS_PROFILE if any of them are set)")
Expand Down
2 changes: 1 addition & 1 deletion internal/config/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Project struct {
Namespace string `mapstructure:",omitempty"`
Env string `mapstructure:",omitempty"`
LogLevel string `mapstructure:"log_level,omitempty"`
PlainText bool `mapstructure:"plain_text,omitempty"`
PlainText bool `mapstructure:"plain_text_output,omitempty"`
CustomPrompt bool `mapstructure:"custom_prompt,omitempty"`
PreferRuntime string `mapstructure:"prefer_runtime,omitempty"`
Tag string `mapstructure:",omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/ize-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"description": "(required) Namespace of the project can be specified here. It is used as a base for all naming. It can be overridden by NAMESPACE env var or --namespace flag."
},
"plain_text": {
"description": "(optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.",
"description": "(optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text-output flag.",
"anyOf": [
{
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions test-e2e/ecs_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func TestIzeExecGoblin(t *testing.T) {

ize := NewBinary(t, izeBinary, examplesRootDir)

stdout, stderr, err := ize.RunPty("--plain-text", "exec", "goblin", "--", "sh -c \"echo $APP_NAME\"")
stdout, stderr, err := ize.RunPty("--plain-text-output", "exec", "goblin", "--", "sh -c \"echo $APP_NAME\"")

if err != nil {
t.Errorf("error: %s", err)
Expand All @@ -347,7 +347,7 @@ func TestIzeExecSquibby(t *testing.T) {

ize := NewBinary(t, izeBinary, examplesRootDir)

stdout, stderr, err := ize.RunPty("--plain-text", "exec", "squibby", "--", "sh -c \"echo $APP_NAME\"")
stdout, stderr, err := ize.RunPty("--plain-text-output", "exec", "squibby", "--", "sh -c \"echo $APP_NAME\"")

if err != nil {
t.Errorf("error: %s", err)
Expand Down

0 comments on commit 0bdf028

Please sign in to comment.