mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
new: implemented events.stream.output (closes #169). new: implemented -no-colors argument.
This commit is contained in:
parent
b63c20b757
commit
e40219976c
9 changed files with 97 additions and 56 deletions
12
core/swag.go
12
core/swag.go
|
@ -26,14 +26,17 @@ var (
|
|||
|
||||
RESET = "\033[0m"
|
||||
|
||||
NoColors = false
|
||||
HasColors = true
|
||||
)
|
||||
|
||||
func init() {
|
||||
NoColors = os.Getenv("TERM") == "dumb" ||
|
||||
func isDumbTerminal() bool {
|
||||
return os.Getenv("TERM") == "dumb" ||
|
||||
os.Getenv("TERM") == "" ||
|
||||
(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
|
||||
if NoColors {
|
||||
}
|
||||
|
||||
func InitSwag(disableColors bool) {
|
||||
if disableColors || isDumbTerminal() {
|
||||
BOLD = ""
|
||||
DIM = ""
|
||||
RED = ""
|
||||
|
@ -48,6 +51,7 @@ func init() {
|
|||
BG_YELLOW = ""
|
||||
BG_LBLUE = ""
|
||||
RESET = ""
|
||||
HasColors = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue