diff options
-rw-r--r-- | src/printer.go | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/src/printer.go b/src/printer.go index f02957b..103ff00 100644 --- a/src/printer.go +++ b/src/printer.go @@ -23,17 +23,16 @@ func printResponses(channels channels) { var color string - // default values: clear the line, print, newline, green - prefix = "\r\033[K" - postfix = "\n" - color = "green" - // hide some of the requests, filter using the status code for _, codeToHide := range hide.HideCode { if response.StatusCode == codeToHide { prefix = "" postfix = "\033[K\r" color = "red" + } else { + prefix = "\r\033[K" + postfix = "\n" + color = "green" } } @@ -42,6 +41,10 @@ func printResponses(channels channels) { prefix = "" postfix = "\033[K\r" color = "red" + } else { + prefix = "\r\033[K" + postfix = "\n" + color = "green" } } @@ -50,6 +53,10 @@ func printResponses(channels channels) { prefix = "" postfix = "\033[K\r" color = "red" + } else { + prefix = "\r\033[K" + postfix = "\n" + color = "green" } } @@ -58,6 +65,59 @@ func printResponses(channels channels) { prefix = "" postfix = "\033[K\r" color = "red" + } else { + prefix = "\r\033[K" + postfix = "\n" + color = "green" + } + } + + // show some of the requests, filter using the status code + for _, codeToShow := range show.ShowCode { + if response.StatusCode == codeToShow { + prefix = "\r\033[K" + postfix = "\n" + color = "green" + } else { + prefix = "" + postfix = "\033[K\r" + color = "red" + } + } + + for _, linesToShow := range show.ShowLine { + if response.ResponseLines == linesToShow { + prefix = "\r\033[K" + postfix = "\n" + color = "green" + } else { + prefix = "" + postfix = "\033[K\r" + color = "red" + } + } + + for _, wordsToShow := range show.ShowWord { + if response.ResponseWords == wordsToShow { + prefix = "\r\033[K" + postfix = "\n" + color = "green" + } else { + prefix = "" + postfix = "\033[K\r" + color = "red" + } + } + + for _, charsToShow := range show.ShowChar { + if response.ResponseChars == charsToShow { + prefix = "\r\033[K" + postfix = "\n" + color = "green" + } else { + prefix = "" + postfix = "\033[K\r" + color = "red" } } @@ -66,6 +126,8 @@ func printResponses(channels channels) { statusCode = red(fmt.Sprintf("%d", response.StatusCode)) } else if color == "green" { statusCode = green(fmt.Sprintf("%d", response.StatusCode)) + } else { + statusCode = cyan(fmt.Sprintf("%d", response.StatusCode)) } // print the requests |