Skip to content

Commit

Permalink
removing status line from output if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
purehyperbole committed Mar 29, 2017
1 parent 18e5546 commit 610bce8
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 9 deletions.
4 changes: 3 additions & 1 deletion c_ebs_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ func (n *EBSVolume) getSingleDetail(c component, prefix string) (lines []Message
if id != "" {
lines = append(lines, Message{Body: " AWS ID : " + id, Level: ""})
}
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func (n *ELB) getSingleDetail(c component, prefix string) (lines []Message) {
return lines
}
lines = append(lines, Message{Body: " " + name, Level: level})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if c["dns_name"] != nil {
dnsName, _ := c["dns_name"].(string)
if dnsName != "" {
Expand Down
4 changes: 3 additions & 1 deletion c_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func (n *Firewall) getSingleDetail(c component, prefix string) (lines []Message)
return lines
}
lines = append(lines, Message{Body: " " + name, Level: level})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ func (n *Instance) getSingleDetail(c component, prefix string) (lines []Message)
if id != "" {
lines = append(lines, Message{Body: " AWS ID : " + id, Level: ""})
}
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ func (n *Nat) getSingleDetail(c component, prefix string) (lines []Message) {
return lines
}
lines = append(lines, Message{Body: " " + name, Level: level})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (n *Network) getSingleDetail(c component, prefix string) (lines []Message)
if id != "" {
lines = append(lines, Message{Body: " AWS ID : " + id, Level: ""})
}
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ func (n *Router) getSingleDetail(c component, prefix string) (lines []Message) {
return lines
}
lines = append(lines, Message{Body: " " + name, Level: level})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func (n *S3Bucket) getSingleDetail(c component, prefix string) (lines []Message)
}
lines = append(lines, Message{Body: " " + name, Level: level})
lines = append(lines, Message{Body: " ACL : " + acl, Level: ""})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down
4 changes: 3 additions & 1 deletion c_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ func (n *Vpc) getSingleDetail(c component, prefix string) (lines []Message) {
}
lines = append(lines, Message{Body: " " + id, Level: level})
lines = append(lines, Message{Body: " Subnet : " + subnet, Level: ""})
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
if status != "" {
lines = append(lines, Message{Body: " Status : " + status, Level: ""})
}
if status == "errored" {
err, _ := c["error"].(string)
lines = append(lines, Message{Body: " Error : " + err, Level: ""})
Expand Down

0 comments on commit 610bce8

Please sign in to comment.