Skip to content

Commit

Permalink
feat: list command now handles number of DFD in output #29
Browse files Browse the repository at this point in the history
  • Loading branch information
xntrik committed Feb 19, 2023
1 parent 08f20ee commit f585d56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions cmd/hcltm/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,7 @@ func (c *ListCommand) Run(args []string) int {
bodyString = bodyString + "-"
}
case "Dfd":
if len(tm.DataFlowDiagrams) > 0 {
bodyString = bodyString + fmt.Sprintf("%t", true)
} else {
bodyString = bodyString + fmt.Sprintf("%t", false)
}
bodyString = bodyString + fmt.Sprintf("%d", len(tm.DataFlowDiagrams))
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/hcltm/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ func TestListRun(t *testing.T) {
{
"valid_dfd_exists",
"./testdata/tm3.hcl",
"true",
"1",
false,
0,
"-fields=dfd",
},
{
"no_valid_dfd_exists",
"./testdata/tm1.hcl",
"false",
"0",
false,
0,
"-fields=dfd",
Expand Down

0 comments on commit f585d56

Please sign in to comment.