aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/i_events.go20
-rw-r--r--src/i_insert.go23
-rw-r--r--src/i_ui.go3
3 files changed, 38 insertions, 8 deletions
diff --git a/src/i_events.go b/src/i_events.go
index 75d9941..82dbb54 100644
--- a/src/i_events.go
+++ b/src/i_events.go
@@ -651,11 +651,21 @@ func i_events(data *HardData) {
case INS_RDP_DRIVE + len(data.insert.Drive): break
case INS_CMD_CMD: ui.buff = data.insert.Host
case INS_CMD_SHELL: ui.buff = data.insert.Shell[0]
+ case INS_CMD_SILENT:
+ data.ui.insert_sel_ok = false
+ if data.insert.Silent == true {
+ data.insert.Silent = false
+ } else {
+ data.insert.Silent = true
+ }
+ break
case INS_SSH_NOTE,
- INS_RDP_NOTE + len(data.insert.Drive):
+ INS_RDP_NOTE + len(data.insert.Drive),
+ INS_CMD_NOTE:
ui.buff = data.insert.Note
case INS_SSH_OK,
- INS_RDP_OK + len(data.insert.Drive):
+ INS_RDP_OK + len(data.insert.Drive),
+ INS_CMD_OK:
data.ui.insert_sel_ok = false
i_insert_check_ok(data, data.insert)
if data.insert_err != nil {
@@ -796,7 +806,8 @@ func i_events(data *HardData) {
INS_RDP_FILE,
INS_RDP_NOTE + len(data.insert.Drive),
INS_CMD_CMD,
- INS_CMD_SHELL:
+ INS_CMD_SHELL,
+ INS_CMD_NOTE:
if event.Key() == tcell.KeyEnter {
switch data.ui.insert_sel {
case INS_SSH_HOST,
@@ -840,7 +851,8 @@ func i_events(data *HardData) {
case INS_CMD_SHELL:
data.insert.Shell[0] = ui.buff
case INS_SSH_NOTE,
- INS_RDP_NOTE + len(data.insert.Drive):
+ INS_RDP_NOTE + len(data.insert.Drive),
+ INS_CMD_NOTE:
data.insert.Note = ui.buff
}
data.ui.insert_sel_ok = false
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
}
diff --git a/src/i_ui.go b/src/i_ui.go
index f0d889c..e5800bf 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -738,7 +738,8 @@ func i_ui(data_dir string) {
i_prompt_generic(data.ui, "Private key: ",
false, home_dir)
case INS_SSH_NOTE,
- INS_RDP_NOTE + len(data.insert.Drive):
+ INS_RDP_NOTE + len(data.insert.Drive),
+ INS_CMD_NOTE:
i_prompt_generic(data.ui, "Note: ", false, "")
case INS_RDP_DOMAIN:
i_prompt_generic(data.ui, "Domain: ", false, "")