mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -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
|
@ -15,23 +15,6 @@ const (
|
|||
DefaultPrompt = "{by}{fw}{cidr} {fb}> {env.iface.ipv4} {reset} {bold}» {reset}"
|
||||
)
|
||||
|
||||
var PromptEffects = map[string]string{
|
||||
"{bold}": core.BOLD,
|
||||
"{dim}": core.DIM,
|
||||
"{r}": core.RED,
|
||||
"{g}": core.GREEN,
|
||||
"{b}": core.BLUE,
|
||||
"{y}": core.YELLOW,
|
||||
"{fb}": core.FG_BLACK,
|
||||
"{fw}": core.FG_WHITE,
|
||||
"{bdg}": core.BG_DGRAY,
|
||||
"{br}": core.BG_RED,
|
||||
"{bg}": core.BG_GREEN,
|
||||
"{by}": core.BG_YELLOW,
|
||||
"{blb}": core.BG_LBLUE, // Ziggy this is for you <3
|
||||
"{reset}": core.RESET,
|
||||
}
|
||||
|
||||
var PromptCallbacks = map[string]func(s *Session) string{
|
||||
"{cidr}": func(s *Session) string {
|
||||
return s.Interface.CIDR()
|
||||
|
@ -71,7 +54,26 @@ func (p Prompt) Render(s *Session) string {
|
|||
prompt = DefaultPrompt
|
||||
}
|
||||
|
||||
for tok, effect := range PromptEffects {
|
||||
// these are here because if colors are disabled,
|
||||
// we need the updated core.* variables
|
||||
var effects = map[string]string{
|
||||
"{bold}": core.BOLD,
|
||||
"{dim}": core.DIM,
|
||||
"{r}": core.RED,
|
||||
"{g}": core.GREEN,
|
||||
"{b}": core.BLUE,
|
||||
"{y}": core.YELLOW,
|
||||
"{fb}": core.FG_BLACK,
|
||||
"{fw}": core.FG_WHITE,
|
||||
"{bdg}": core.BG_DGRAY,
|
||||
"{br}": core.BG_RED,
|
||||
"{bg}": core.BG_GREEN,
|
||||
"{by}": core.BG_YELLOW,
|
||||
"{blb}": core.BG_LBLUE, // Ziggy this is for you <3
|
||||
"{reset}": core.RESET,
|
||||
}
|
||||
|
||||
for tok, effect := range effects {
|
||||
prompt = strings.Replace(prompt, tok, effect, -1)
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,8 @@ func New() (*Session, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
core.InitSwag(*s.Options.NoColors)
|
||||
|
||||
if *s.Options.CpuProfile != "" {
|
||||
if f, err := os.Create(*s.Options.CpuProfile); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue