Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename StateShow to Show #30

Merged
merged 1 commit into from
Jul 16, 2020
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
2 changes: 1 addition & 1 deletion tfexec/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestImport(t *testing.T) {
return
}

state, err := tf.StateShow(ctx)
state, err := tf.Show(ctx)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions tfexec/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
tfjson "github.com/hashicorp/terraform-json"
)

func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) {
func (tf *Terraform) Show(ctx context.Context) (*tfjson.State, error) {
var ret tfjson.State

var errBuf strings.Builder
var outBuf bytes.Buffer

showCmd := tf.stateShowCmd(ctx)
showCmd := tf.showCmd(ctx)

showCmd.Stderr = &errBuf
showCmd.Stdout = &outBuf
Expand All @@ -39,7 +39,7 @@ func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) {
return &ret, nil
}

func (tf *Terraform) stateShowCmd(ctx context.Context, args ...string) *exec.Cmd {
func (tf *Terraform) showCmd(ctx context.Context, args ...string) *exec.Cmd {
allArgs := []string{"show", "-json", "-no-color"}
allArgs = append(allArgs, args...)

Expand Down
10 changes: 5 additions & 5 deletions tfexec/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
tfjson "github.com/hashicorp/terraform-json"
)

func TestStateShow(t *testing.T) {
func TestShow(t *testing.T) {
td := testTempDir(t)
defer os.RemoveAll(td)

Expand Down Expand Up @@ -52,7 +52,7 @@ func TestStateShow(t *testing.T) {
t.Fatalf("error running Init in test directory: %s", err)
}

actual, err := tf.StateShow(context.Background())
actual, err := tf.Show(context.Background())
if err != nil {
t.Fatal(err)
}
Expand All @@ -73,7 +73,7 @@ func TestShow_errInitRequired(t *testing.T) {

err = copyFile(filepath.Join(testFixtureDir, "basic", testTerraformStateFileName), td)

_, err = tf.StateShow(context.Background())
_, err = tf.Show(context.Background())
if err == nil {
t.Fatal("expected Show to error, but it did not")
} else {
Expand All @@ -84,7 +84,7 @@ func TestShow_errInitRequired(t *testing.T) {

}

func TestStateShowCmd(t *testing.T) {
func TestShowCmd(t *testing.T) {
td := testTempDir(t)
defer os.RemoveAll(td)

Expand All @@ -94,7 +94,7 @@ func TestStateShowCmd(t *testing.T) {
}

// defaults
showCmd := tf.stateShowCmd(context.Background())
showCmd := tf.showCmd(context.Background())

actual := strings.TrimPrefix(cmdString(showCmd), showCmd.Path+" ")

Expand Down