diff options
Diffstat (limited to 'src/i_info.go')
-rw-r--r-- | src/i_info.go | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/src/i_info.go b/src/i_info.go index 14eb9b0..f36a998 100644 --- a/src/i_info.go +++ b/src/i_info.go @@ -63,24 +63,24 @@ func i_info_dirs(ui HardUI, dir *DirsNode) { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Name: ") + ui.style[TITLE_STYLE], "Name: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], dir.Name) + ui.style[DEF_STYLE], dir.Name) if line += 1; line > ui.dim[H] - 3 { return } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Type: ") + ui.style[TITLE_STYLE], "Type: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], "Directory") + ui.style[DEF_STYLE], "Directory") if line += 2; line > ui.dim[H] - 3 { return } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Path: ") + ui.style[TITLE_STYLE], "Path: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], dir.path()[1:]) + ui.style[DEF_STYLE], dir.path()[1:]) } func i_info_name_type(ui HardUI, host *HostNode) int { @@ -90,17 +90,17 @@ func i_info_name_type(ui HardUI, host *HostNode) int { // name, type i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Name: ") + ui.style[TITLE_STYLE], "Name: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Name) + ui.style[DEF_STYLE], host.Name) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Type: ") + ui.style[TITLE_STYLE], "Type: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host_type) + ui.style[DEF_STYLE], host_type) if line += 2; line > ui.dim[H] - 3 { return line } return line } @@ -110,42 +110,42 @@ func i_info_ssh(ui HardUI, host *HostNode, line int) int { // host, port i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Host: ") + ui.style[TITLE_STYLE], "Host: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Host) + ui.style[DEF_STYLE], host.Host) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Port: ") + ui.style[TITLE_STYLE], "Port: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], strconv.Itoa(int(host.Port))) + ui.style[DEF_STYLE], strconv.Itoa(int(host.Port))) if line += 2; line > ui.dim[H] - 3 { return line } // user infos i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "User: ") + ui.style[TITLE_STYLE], "User: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.User) + ui.style[DEF_STYLE], host.User) if line += 1; line > ui.dim[H] - 3 { return line } if len(host.Pass) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Pass: ") + ui.style[TITLE_STYLE], "Pass: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], "***") + ui.style[DEF_STYLE], "***") if line += 1; line > ui.dim[H] - 3 { return line } } if len(host.Priv) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Privkey: ") + ui.style[TITLE_STYLE], "Privkey: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 12, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Priv) + ui.style[DEF_STYLE], host.Priv) if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } @@ -153,45 +153,45 @@ func i_info_ssh(ui HardUI, host *HostNode, line int) int { if len(host.Jump.Host) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Jump settings: ") + ui.style[TITLE_STYLE], "Jump settings: ") if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Host: ") + ui.style[TITLE_STYLE], "Host: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Jump.Host) + ui.style[DEF_STYLE], host.Jump.Host) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Port: ") + ui.style[TITLE_STYLE], "Port: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], strconv.Itoa(int(host.Jump.Port))) + ui.style[DEF_STYLE], strconv.Itoa(int(host.Jump.Port))) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "User: ") + ui.style[TITLE_STYLE], "User: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Jump.User) + ui.style[DEF_STYLE], host.Jump.User) if line += 1; line > ui.dim[H] - 3 { return line } if len(host.Jump.Pass) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Pass: ") + ui.style[TITLE_STYLE], "Pass: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], "***") + ui.style[DEF_STYLE], "***") if line += 1; line > ui.dim[H] - 3 { return line } } if len(host.Jump.Priv) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Privkey: ") + ui.style[TITLE_STYLE], "Privkey: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 13, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Jump.Priv) + ui.style[DEF_STYLE], host.Jump.Priv) if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } @@ -204,53 +204,53 @@ func i_info_rdp(ui HardUI, host *HostNode, line int) int { // host, port i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Host: ") + ui.style[TITLE_STYLE], "Host: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Host) + ui.style[DEF_STYLE], host.Host) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Port: ") + ui.style[TITLE_STYLE], "Port: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], strconv.Itoa(int(host.Port))) + ui.style[DEF_STYLE], strconv.Itoa(int(host.Port))) if line += 1; line > ui.dim[H] - 3 { return line } // rdp shit if len(host.Domain) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Domain: ") + ui.style[TITLE_STYLE], "Domain: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 11, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Domain) + ui.style[DEF_STYLE], host.Domain) if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } if len(host.RDPFile) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "RDP File: ") + ui.style[TITLE_STYLE], "RDP File: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 13, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.RDPFile) + ui.style[DEF_STYLE], host.RDPFile) if line += 2; line > ui.dim[H] - 3 { return line } } // user infos i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "User: ") + ui.style[TITLE_STYLE], "User: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.User) + ui.style[DEF_STYLE], host.User) if line += 1; line > ui.dim[H] - 3 { return line } if len(host.Pass) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Pass: ") + ui.style[TITLE_STYLE], "Pass: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], "***") + ui.style[DEF_STYLE], "***") if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } @@ -258,40 +258,40 @@ func i_info_rdp(ui HardUI, host *HostNode, line int) int { qual := [3]string{"Low", "Medium", "High"} i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Screen size: ") + ui.style[TITLE_STYLE], "Screen size: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 16, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], + ui.style[DEF_STYLE], strconv.Itoa(int(host.Width)) + "x" + strconv.Itoa(int(host.Height))) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Dynamic window: ") + ui.style[TITLE_STYLE], "Dynamic window: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 19, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], strconv.FormatBool(host.Dynamic)) + ui.style[DEF_STYLE], strconv.FormatBool(host.Dynamic)) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Quality: ") + ui.style[TITLE_STYLE], "Quality: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 12, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], qual[host.Quality]) + ui.style[DEF_STYLE], qual[host.Quality]) if line += 2; line > ui.dim[H] - 3 { return line } if host.Drive != nil { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Drives: ") + ui.style[TITLE_STYLE], "Drives: ") if line += 1; line > ui.dim[H] - 3 { return line } for share, path := range host.Drive { i_draw_text(ui.s, (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], share + ":") + ui.style[TITLE_STYLE], share + ":") i_draw_text(ui.s, (ui.dim[W] / 3) + 4 + len(share) + 2, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], path) + ui.style[DEF_STYLE], path) if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } @@ -303,28 +303,28 @@ func i_info_cmd(ui HardUI, host *HostNode, line int) int { if line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Command: ") + ui.style[TITLE_STYLE], "Command: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 12, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Host) + ui.style[DEF_STYLE], host.Host) if line += 2; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Silent: ") + ui.style[TITLE_STYLE], "Silent: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 11, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], strconv.FormatBool(host.Silent)) + ui.style[DEF_STYLE], strconv.FormatBool(host.Silent)) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Shell: ") + ui.style[TITLE_STYLE], "Shell: ") str := "" for _, s := range host.Shell { str += s + " " } i_draw_text(ui.s, (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], str) + ui.style[DEF_STYLE], str) if line += 2; line > ui.dim[H] - 3 { return line } return line } @@ -333,47 +333,47 @@ func i_info_openstack(ui HardUI, host *HostNode, line int) int { if line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Endpoint: ") + ui.style[TITLE_STYLE], "Endpoint: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 13, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Host) + ui.style[DEF_STYLE], host.Host) if line += 2; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "User domain ID: ") + ui.style[TITLE_STYLE], "User domain ID: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 19, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Stack.UserDomainID) + ui.style[DEF_STYLE], host.Stack.UserDomainID) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Project ID: ") + ui.style[TITLE_STYLE], "Project ID: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 15, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Stack.ProjectID) + ui.style[DEF_STYLE], host.Stack.ProjectID) if line += 1; line > ui.dim[H] - 3 { return line } i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Region name: ") + ui.style[TITLE_STYLE], "Region name: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 16, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Stack.RegionName) + ui.style[DEF_STYLE], host.Stack.RegionName) if line += 2; line > ui.dim[H] - 3 { return line } // user infos i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "User: ") + ui.style[TITLE_STYLE], "User: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.User) + ui.style[DEF_STYLE], host.User) if line += 1; line > ui.dim[H] - 3 { return line } if len(host.Pass) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Pass: ") + ui.style[TITLE_STYLE], "Pass: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], "***") + ui.style[DEF_STYLE], "***") if line += 1; line > ui.dim[H] - 3 { return line } } if line += 1; line > ui.dim[H] - 3 { return line } @@ -388,10 +388,10 @@ func i_info_note(ui HardUI, host *HostNode, line int) { if len(host.Note) > 0 { i_draw_text(ui.s, (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line, - ui.style[STYLE_TITLE], "Note: ") + ui.style[TITLE_STYLE], "Note: ") i_draw_text(ui.s, (ui.dim[W] / 3) + 9, line, ui.dim[W] - 2, line, - ui.style[STYLE_DEF], host.Note) + ui.style[DEF_STYLE], host.Note) } } @@ -400,10 +400,10 @@ func i_draw_info_panel(ui HardUI, percent bool, litems *ItemsList) { i_draw_box(ui.s, (ui.dim[W] / 3), 0, ui.dim[W] - 1, ui.dim[H] - 2, - ui.style[STYLE_BOX], ui.style[STYLE_HEAD], " Infos ", false) - ui.s.SetContent(ui.dim[W] / 3, 0, tcell.RuneTTee, nil, ui.style[STYLE_BOX]) + ui.style[BOX_STYLE], ui.style[HEAD_STYLE], " Infos ", false) + ui.s.SetContent(ui.dim[W] / 3, 0, tcell.RuneTTee, nil, ui.style[BOX_STYLE]) ui.s.SetContent(ui.dim[W] / 3, ui.dim[H] - 2, - tcell.RuneBTee, nil, ui.style[STYLE_BOX]) + tcell.RuneBTee, nil, ui.style[BOX_STYLE]) if litems == nil { return } @@ -420,7 +420,7 @@ func i_draw_info_panel(ui HardUI, percent bool, litems *ItemsList) { ui.dim[H] - 2, (ui.dim[W] - 1) - 1, ui.dim[H] - 2, - ui.style[STYLE_DEF], + ui.style[DEF_STYLE], text) } else { text := " 0 hosts " @@ -429,7 +429,7 @@ func i_draw_info_panel(ui HardUI, percent bool, litems *ItemsList) { ui.dim[H] - 2, (ui.dim[W] - 1) - 1, ui.dim[H] - 2, - ui.style[STYLE_DEF], + ui.style[DEF_STYLE], text) } // panel |