Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit be4289f

Browse files
committed
Fix version logging statement
TerrafilePath is now a complete path to Terrafile Add TODO section to README
1 parent 710aa1b commit be4289f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ INFO[0000] [*] Checking out master of [email protected]:terraform-aws-modules/terra
4040

4141
Terrafile config file in custom directory
4242
```sh
43-
$ terrafile -f config/
43+
$ terrafile -f config/Terrafile
4444
INFO[0000] [*] Checking out v1.46.0 of [email protected]:terraform-aws-modules/terraform-aws-vpc
4545
INFO[0000] [*] Checking out master of [email protected]:terraform-aws-modules/terraform-aws-vpc
4646
```
@@ -50,4 +50,10 @@ Terraform modules exported to custom directory
5050
$ terrafile -p custom_directory
5151
INFO[0000] [*] Checking out master of [email protected]:terraform-aws-modules/terraform-aws-vpc
5252
INFO[0001] [*] Checking out v1.46.0 of [email protected]:terraform-aws-modules/terraform-aws-vpc
53-
```
53+
```
54+
55+
## TODO
56+
* Break out the main logic into seperate commands (e.g. version, help, run)
57+
* Update tests to include unit tests for broken out commands
58+
* Add coverage tool and badge
59+
* May be worth renaming Terrafile config file to something that won't be misinterpreted as the binary

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type module struct {
2020
var opts struct {
2121
ModulePath string `short:"p" long:"module_path" default:"./vendor/modules" description:"File path to install generated terraform modules"`
2222

23-
TerrafilePath string `short:"f" long:"terrafile_file" default:"." description:"File path in which the Terrafile file is located"`
23+
TerrafilePath string `short:"f" long:"terrafile_file" default:"./Terrafile" description:"File path to the Terrafile file"`
2424
}
2525

2626
// To be set by goreleaser on build
@@ -46,7 +46,7 @@ func gitClone(repository string, version string, moduleName string) {
4646
}
4747

4848
func main() {
49-
log.Printf("Terraform: version %v, commit %v, built at %v", version, commit, date)
49+
fmt.Printf("Terrafile: version %v, commit %v, built at %v \n", version, commit, date)
5050
_, err := flags.Parse(&opts)
5151

5252
// Invalid choice
@@ -55,7 +55,7 @@ func main() {
5555
}
5656

5757
// Read File
58-
yamlFile, err := ioutil.ReadFile(fmt.Sprint(opts.TerrafilePath, "/Terrafile"))
58+
yamlFile, err := ioutil.ReadFile(opts.TerrafilePath)
5959
if err != nil {
6060
log.Fatalln(err)
6161
}

main_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"io/ioutil"
56
"os"
67
"path"
@@ -25,7 +26,7 @@ func TestTerraformWithTerrafilePath(t *testing.T) {
2526
folder, back := setup(t)
2627
defer back()
2728

28-
testcli.Run(terrafileBinaryPath, "-f", folder)
29+
testcli.Run(terrafileBinaryPath, "-f", fmt.Sprint(folder, "/terrafile"))
2930

3031
if !testcli.Success() {
3132
t.Fatalf("Expected to succeed, but failed: %q with message: %q", testcli.Error(), testcli.Stderr())

0 commit comments

Comments
 (0)