diff options
author | Joe <rbo@gmx.us> | 2024-04-16 20:20:20 +0200 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-04-16 20:20:20 +0200 |
commit | ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc (patch) | |
tree | 3144d51c6513b25aac52ab6e9f2fd96f5a70f133 /src/i_insert.go | |
parent | cool (diff) | |
download | hardflip-ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc.tar.gz hardflip-ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc.tar.bz2 hardflip-ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc.tar.xz hardflip-ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc.tar.zst hardflip-ffe9dd81bbf9e7d27c4d1b347b5ac135dc7680dc.zip |
good commands
Diffstat (limited to '')
-rw-r--r-- | src/i_insert.go | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/i_insert.go b/src/i_insert.go index c9dbed6..bdf00ed 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_insert.go - * Tue Apr 16 15:42:45 2024 + * Tue Apr 16 16:32:29 2024 * Joe * * insert a new host @@ -197,10 +197,15 @@ func i_insert_check_ok(data *HardData, in *HostNode) { } if len(in.Host) == 0 { if (in.Protocol == PROTOCOL_RDP && len(in.RDPFile) > 0) == false { - data.insert_err = append(data.insert_err, errors.New("no host")) + text := "no host" + if in.Protocol == PROTOCOL_CMD { + text = "no command" + } + data.insert_err = append(data.insert_err, errors.New(text)) } } - if in.Port == 0 { + if (in.Protocol == PROTOCOL_SSH || in.Protocol == PROTOCOL_RDP) && + in.Port == 0 { data.insert_err = append(data.insert_err, errors.New("port can't be 0")) } if len(in.Jump.Host) > 0 && in.Jump.Port == 0 { @@ -576,6 +581,18 @@ func i_draw_insert_cmd(ui HardUI, line int, win Quad, in *HostNode) int { win.R - 1, win.T + line, ui.style[ERR_STYLE], text) } red = false + if line += 1; win.T + line >= win.B { return line } + i_draw_tick_box(ui, win.T + line, win, "Silent", in.Silent, + INS_CMD_SILENT, ui.insert_sel) + if line += 2; win.T + line >= win.B { return line } + text = "---- Note ----" + i_draw_text(ui.s, ui.dim[W] / 2 - len(text) / 2, win.T + line, win.R - 1, + win.T + line, ui.style[DEF_STYLE], text) + if line += 2; win.T + line >= win.B { return line } + i_draw_text_box(ui, win.T + line, win, "Note", in.Note, + INS_CMD_NOTE, false) + if line += 2; win.T + line >= win.B { return line } + i_draw_ok_butt(ui, win.T + line, INS_CMD_OK, ui.insert_sel) return line } |