parent
8874454a0f
commit
ec60a3d506
@ -89,6 +89,24 @@ func ClientShow(format, stream, filter string, regex *regexp.Regexp) {
|
|||||||
if response.Err != nil {
|
if response.Err != nil {
|
||||||
logger.Fatalln("Received error from daemon:", response.Err)
|
logger.Fatalln("Received error from daemon:", response.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove empty structs
|
||||||
|
for streamName := range response.ClientStatus {
|
||||||
|
for filterName := range response.ClientStatus[streamName] {
|
||||||
|
for patternName, patternMap := range response.ClientStatus[streamName][filterName] {
|
||||||
|
if len(patternMap.Actions) == 0 && patternMap.Matches == 0 {
|
||||||
|
delete(response.ClientStatus[streamName][filterName], patternName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(response.ClientStatus[streamName][filterName]) == 0 {
|
||||||
|
delete(response.ClientStatus[streamName], filterName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(response.ClientStatus[streamName]) == 0 {
|
||||||
|
delete(response.ClientStatus, streamName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Limit to stream, filter if exists
|
// Limit to stream, filter if exists
|
||||||
if stream != "" {
|
if stream != "" {
|
||||||
exists := false
|
exists := false
|
||||||
@ -114,6 +132,7 @@ func ClientShow(format, stream, filter string, regex *regexp.Regexp) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit to pattern
|
// Limit to pattern
|
||||||
if regex != nil {
|
if regex != nil {
|
||||||
for streamName := range response.ClientStatus {
|
for streamName := range response.ClientStatus {
|
||||||
@ -132,6 +151,7 @@ func ClientShow(format, stream, filter string, regex *regexp.Regexp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var text []byte
|
var text []byte
|
||||||
var err error
|
var err error
|
||||||
if format == "json" {
|
if format == "json" {
|
||||||
|
Loading…
Reference in New Issue
Block a user