Skip to content

Commit

Permalink
Output only names of resource type on resource list
Browse files Browse the repository at this point in the history
  • Loading branch information
minamijoyo committed Jan 23, 2018
1 parent 00883dd commit 66076fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion command/resource_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func (c *ResourceListCommand) Run(args []string) int {

defer client.Kill()

client.List()
resourceTypes := client.List()
c.Ui.Output(strings.Join(resourceTypes, "\n"))

return 0
}
Expand Down
9 changes: 7 additions & 2 deletions tfschema/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ func (c *Client) GetSchema(resourceType string) error {
return nil
}

func (c *Client) List() {
func (c *Client) List() []string {
res := c.provider.Resources()

pp.Println(res)
resourceTypes := []string{}
for _, r := range res {
resourceTypes = append(resourceTypes, r.Name)
}

return resourceTypes
}

func (c *Client) Kill() {
Expand Down

0 comments on commit 66076fe

Please sign in to comment.