diff options
author | Joe <rbo@gmx.us> | 2024-03-19 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-03-19 20:20:20 +0100 |
commit | c596bf0560c2eceb25e00ed57586d31a629bd695 (patch) | |
tree | 7b5366887a2a56b5a1cf6f7fdc2e97e74a663654 /src/i_insert.go | |
parent | port (diff) | |
download | hardflip-c596bf0560c2eceb25e00ed57586d31a629bd695.tar.gz hardflip-c596bf0560c2eceb25e00ed57586d31a629bd695.tar.bz2 hardflip-c596bf0560c2eceb25e00ed57586d31a629bd695.tar.xz hardflip-c596bf0560c2eceb25e00ed57586d31a629bd695.tar.zst hardflip-c596bf0560c2eceb25e00ed57586d31a629bd695.zip |
go
Diffstat (limited to '')
-rw-r--r-- | src/i_insert.go | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/i_insert.go b/src/i_insert.go index a0f629f..23c2bc6 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -71,7 +71,7 @@ func i_draw_text_box(ui HardUI, line int, dim Quad, label, content string, if l <= dim.L { l = dim.L + 1 } i_draw_text(ui.s, l, line, ui.dim[W] / 2, line, ui.style[DEF_STYLE], label) - if id == 4 && len(content) > 0 { + if (id == 4 || id == 9) && len(content) > 0 { content = "***" } if red == true { @@ -150,6 +150,7 @@ func i_draw_insert_ssh(ui HardUI, line int, win Quad, in *HostNode) { i_draw_text(ui.s, ui.dim[W] / 2, win.T + line, win.R - 1, win.T + line, ui.style[ERR_STYLE], text) } + red = false if line += 2; win.T + line >= win.B { return } text = "---- Jump settings ----" i_draw_text(ui.s, ui.dim[W] / 2 - len(text) / 2, win.T + line, win.R - 1, @@ -160,5 +161,31 @@ func i_draw_insert_ssh(ui HardUI, line int, win Quad, in *HostNode) { if line += 1; win.T + line >= win.B { return } i_draw_text_box(ui, win.T + line, win, "Port", strconv.Itoa(int(in.Jump.Port)), 7, ui.insert_sel, false) + if line += 2; win.T + line >= win.B { return } + i_draw_text_box(ui, win.T + line, win, "User", + in.Jump.User, 8, ui.insert_sel, false) + if line += 1; win.T + line >= win.B { return } + i_draw_text_box(ui, win.T + line, win, "Pass", + in.Jump.Pass, 9, ui.insert_sel, false) + if line += 1; win.T + line >= win.B { return } + if len(in.Jump.Priv) > 0 { + file := in.Jump.Priv + if file[0] == '~' { + home, _ := os.UserHomeDir() + file = home + file[1:] + } + if stat, err := os.Stat(file); + err != nil || stat.IsDir() == true { + red = true + } + } + i_draw_text_box(ui, win.T + line, win, "SSH private key", + in.Jump.Priv, 10, ui.insert_sel, red) + if red == true { + if line += 1; win.T + line >= win.B { return } + text := "file does not exist" + i_draw_text(ui.s, ui.dim[W] / 2, win.T + line, + win.R - 1, win.T + line, ui.style[ERR_STYLE], text) + } // TODO: here } |