aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/c_defs.go7
-rw-r--r--src/i_events.go3
-rw-r--r--src/i_insert.go29
3 files changed, 33 insertions, 6 deletions
diff --git a/src/c_defs.go b/src/c_defs.go
index 2781c53..a1da14f 100644
--- a/src/c_defs.go
+++ b/src/c_defs.go
@@ -133,8 +133,13 @@ const (
INS_RDP_QUALITY
INS_RDP_DRIVE
INS_RDP_NOTE
- // TODO: here
INS_RDP_OK
+ INS_CMD_CMD
+ INS_CMD_SHELL
+ INS_CMD_SILENT
+ INS_CMD_NOTE
+ INS_CMD_OK
+ // TODO: here
)
var (
diff --git a/src/i_events.go b/src/i_events.go
index b0d0fda..268fda5 100644
--- a/src/i_events.go
+++ b/src/i_events.go
@@ -340,8 +340,9 @@ func i_set_protocol_defaults(data *HardData, in *HostNode) {
data.ui.insert_sel_max = INS_RDP_OK + len(in.Drive)
in.drive_keys = nil
case PROTOCOL_CMD:
+ in.Silent = false
in.Shell = []string{"/bin/sh", "-c"}
- data.ui.insert_sel_max = 2
+ data.ui.insert_sel_max = INS_CMD_OK
case PROTOCOL_OS:
in.Stack.RegionName = "eu-west-0"
in.Stack.IdentityAPI = "3"
diff --git a/src/i_insert.go b/src/i_insert.go
index 80f4236..f1838d5 100644
--- a/src/i_insert.go
+++ b/src/i_insert.go
@@ -547,10 +547,31 @@ func i_draw_insert_rdp(ui HardUI, line int, win Quad, in *HostNode) int {
return line
}
-func i_draw_insert_os(ui HardUI, line int, win Quad, in *HostNode) int {
- return 0
+func i_draw_insert_cmd(ui HardUI, line int, win Quad, in *HostNode) int {
+ red := false
+ if win.T + line >= win.B { return line }
+ text := "---- Settings ----"
+ 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, "Command", in.Host,
+ INS_CMD_CMD, false)
+ if line += 1; win.T + line >= win.B { return line }
+ if shell := in.Shell[0]; len(shell) > 0 {
+ if shell[0] == '~' {
+ home, _ := os.UserHomeDir()
+ shell = home + shell[1:]
+ }
+ if stat, err := os.Stat(shell);
+ err != nil || stat.IsDir() == true {
+ red = true
+ }
+ }
+ i_draw_text_box(ui, win.T + line, win, "Shell", in.Shell[0],
+ INS_CMD_SHELL, red);
+ return line
}
-func i_draw_insert_cmd(ui HardUI, line int, win Quad, in *HostNode) int {
- return 0
+func i_draw_insert_os(ui HardUI, line int, win Quad, in *HostNode) int {
+ return line
}