aboutsummaryrefslogtreecommitdiffstats
path: root/src/e_keys.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-05-13 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-05-13 20:20:20 +0200
commit61905a7b4d0e22fd5ce767ff525cc46259e116fe (patch)
treea0f1370a5009ec0058c5b5d71a8a15e747a4be49 /src/e_keys.go
parentthis is gon be tight (diff)
downloadhardflip-61905a7b4d0e22fd5ce767ff525cc46259e116fe.tar.gz
hardflip-61905a7b4d0e22fd5ce767ff525cc46259e116fe.tar.bz2
hardflip-61905a7b4d0e22fd5ce767ff525cc46259e116fe.tar.xz
hardflip-61905a7b4d0e22fd5ce767ff525cc46259e116fe.tar.zst
hardflip-61905a7b4d0e22fd5ce767ff525cc46259e116fe.zip
reading so many lines
Diffstat (limited to 'src/e_keys.go')
-rw-r--r--src/e_keys.go152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/e_keys.go b/src/e_keys.go
index 2d05380..f721cf7 100644
--- a/src/e_keys.go
+++ b/src/e_keys.go
@@ -245,9 +245,9 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
data.litems.curr != nil {
ui.mode = RENAME_MODE
if data.litems.curr.is_dir() == false {
- ui.buff = data.litems.curr.Host.Name
+ ui.buff.str = data.litems.curr.Host.Name
} else {
- ui.buff = data.litems.curr.Dirs.Name
+ ui.buff.str = data.litems.curr.Dirs.Name
}
} else if event.Rune() == '?' {
ui.mode = HELP_MODE
@@ -317,13 +317,13 @@ func e_mkdir_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
event.Key() == tcell.KeyCtrlC {
ui.s.HideCursor()
ui.mode = NORMAL_MODE
- ui.buff = ""
+ ui.buff.str = ""
data.insert = nil
} else if event.Key() == tcell.KeyEnter {
e_mkdir(data, ui)
ui.s.HideCursor()
ui.mode = NORMAL_MODE
- ui.buff = ""
+ ui.buff.str = ""
} else {
e_readline(event, &ui.buff)
}
@@ -338,22 +338,22 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
ui.mode = NORMAL_MODE
ui.insert_sel = 0
data.insert = nil
- ui.buff = ""
+ ui.buff.str = ""
} else if event.Key() == tcell.KeyEnter {
- if ui.buff == "" {
+ if ui.buff.str == "" {
ui.s.HideCursor()
ui.mode = NORMAL_MODE
ui.insert_sel = 0
ui.insert_sel_ok = false
data.insert = nil
- ui.buff = ""
+ ui.buff.str = ""
return true
}
ui.s.HideCursor()
data.insert = &HostNode{}
e_set_protocol_defaults(data, data.insert)
- data.insert.Name = ui.buff
- ui.buff = ""
+ data.insert.Name = ui.buff.str
+ ui.buff.str = ""
if data.litems.curr != nil {
data.insert.parent = data.litems.curr.path_node()
} else {
@@ -377,7 +377,7 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
ui.mode = NORMAL_MODE
ui.insert_sel = 0
data.insert = nil
- ui.buff = ""
+ ui.buff.str = ""
} else if event.Rune() == 'j' ||
event.Key() == tcell.KeyDown ||
event.Key() == tcell.KeyTab {
@@ -467,42 +467,42 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_SSH_HOST,
INS_RDP_HOST,
INS_OS_HOST:
- ui.buff = data.insert.Host
+ ui.buff.str = data.insert.Host
case INS_SSH_PORT,
INS_RDP_PORT:
if data.insert.Port > 0 {
- ui.buff = strconv.Itoa(int(data.insert.Port))
+ ui.buff.str = strconv.Itoa(int(data.insert.Port))
}
case INS_SSH_USER,
INS_RDP_USER,
INS_OS_USER:
- ui.buff = data.insert.User
+ ui.buff.str = data.insert.User
case INS_SSH_PASS,
INS_RDP_PASS,
INS_OS_PASS:
return true
- case INS_SSH_PRIV: ui.buff = data.insert.Priv
- case INS_SSH_EXEC: ui.buff = data.insert.Exec
+ case INS_SSH_PRIV: ui.buff.str = data.insert.Priv
+ case INS_SSH_EXEC: ui.buff.str = data.insert.Exec
case INS_SSH_JUMP_HOST,
INS_RDP_JUMP_HOST + len(data.insert.Drive):
- ui.buff = data.insert.Jump.Host
+ ui.buff.str = data.insert.Jump.Host
case INS_SSH_JUMP_PORT,
INS_RDP_JUMP_PORT + len(data.insert.Drive):
if data.insert.Jump.Port > 0 {
- ui.buff = strconv.Itoa(int(
+ ui.buff.str = strconv.Itoa(int(
data.insert.Jump.Port))
}
case INS_SSH_JUMP_USER,
INS_RDP_JUMP_USER + len(data.insert.Drive):
- ui.buff = data.insert.Jump.User
+ ui.buff.str = data.insert.Jump.User
case INS_SSH_JUMP_PASS,
INS_RDP_JUMP_PASS + len(data.insert.Drive):
return true
case INS_SSH_JUMP_PRIV,
INS_RDP_JUMP_PRIV + len(data.insert.Drive):
- ui.buff = data.insert.Jump.Priv
- case INS_RDP_DOMAIN: ui.buff = data.insert.Domain
- case INS_RDP_FILE: ui.buff = data.insert.RDPFile
+ ui.buff.str = data.insert.Jump.Priv
+ case INS_RDP_DOMAIN: ui.buff.str = data.insert.Domain
+ case INS_RDP_FILE: ui.buff.str = data.insert.RDPFile
case INS_RDP_SCREENSIZE: return true
case INS_RDP_DYNAMIC:
ui.insert_sel_ok = false
@@ -530,8 +530,8 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
return true
case INS_RDP_QUALITY: return true
case INS_RDP_DRIVE + len(data.insert.Drive): return true
- case INS_CMD_CMD: ui.buff = data.insert.Host
- case INS_CMD_SHELL: ui.buff = data.insert.Shell[0]
+ case INS_CMD_CMD: ui.buff.str = data.insert.Host
+ case INS_CMD_SHELL: ui.buff.str = data.insert.Shell[0]
case INS_CMD_SILENT:
ui.insert_sel_ok = false
if data.insert.Silent == true {
@@ -541,35 +541,35 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
}
return true
case INS_OS_USERDOMAINID:
- ui.buff = data.insert.Stack.UserDomainID
+ ui.buff.str = data.insert.Stack.UserDomainID
case INS_OS_PROJECTID:
- ui.buff = data.insert.Stack.ProjectID
+ ui.buff.str = data.insert.Stack.ProjectID
case INS_OS_REGION:
- ui.buff = data.insert.Stack.RegionName
+ ui.buff.str = data.insert.Stack.RegionName
case INS_OS_ENDTYPE:
- ui.buff = data.insert.Stack.EndpointType
+ ui.buff.str = data.insert.Stack.EndpointType
case INS_OS_INTERFACE:
- ui.buff = data.insert.Stack.Interface
+ ui.buff.str = data.insert.Stack.Interface
case INS_OS_IDAPI:
- ui.buff = data.insert.Stack.IdentityAPI
+ ui.buff.str = data.insert.Stack.IdentityAPI
case INS_OS_IMGAPI:
- ui.buff = data.insert.Stack.ImageAPI
+ ui.buff.str = data.insert.Stack.ImageAPI
case INS_OS_NETAPI:
- ui.buff = data.insert.Stack.NetworkAPI
+ ui.buff.str = data.insert.Stack.NetworkAPI
case INS_OS_VOLAPI:
- ui.buff = data.insert.Stack.VolumeAPI
+ ui.buff.str = data.insert.Stack.VolumeAPI
case INS_SSH_NOTE,
INS_RDP_NOTE + len(data.insert.Drive),
INS_CMD_NOTE,
INS_OS_NOTE:
- ui.buff = data.insert.Note
+ ui.buff.str = data.insert.Note
}
}
} else {
if event.Key() == tcell.KeyEscape ||
event.Key() == tcell.KeyCtrlC {
ui.insert_sel_ok = false
- ui.buff = ""
+ ui.buff.str = ""
ui.drives_buff = ""
ui.s.HideCursor()
}
@@ -595,7 +595,7 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_PROTOCOL:
if event.Rune() < '1' || event.Rune() > '4' {
ui.insert_sel_ok = false
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
return true
} else {
@@ -615,7 +615,7 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_RDP_SCREENSIZE:
if event.Rune() < '1' || event.Rune() > '7' {
ui.insert_sel_ok = false
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
return true
} else {
@@ -635,7 +635,7 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_RDP_QUALITY:
if event.Rune() < '1' || event.Rune() > '3' {
ui.insert_sel_ok = false
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
return true
} else {
@@ -646,35 +646,35 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_RDP_DRIVE + len(data.insert.Drive):
if len(ui.drives_buff) == 0 {
if event.Key() == tcell.KeyEnter {
- if len(ui.buff) == 0 {
+ if len(ui.buff.str) == 0 {
ui.insert_sel_ok = false
ui.drives_buff = ""
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
return true
}
- ui.drives_buff = ui.buff
- ui.buff = ""
+ ui.drives_buff = ui.buff.str
+ ui.buff.str = ""
} else {
e_readline(event, &ui.buff)
}
} else {
if event.Key() == tcell.KeyEnter {
- if len(ui.buff) == 0 {
+ if len(ui.buff.str) == 0 {
ui.insert_sel_ok = false
ui.drives_buff = ""
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
return true
}
if len(data.insert.Drive) == 0 {
data.insert.Drive = make(map[string]string)
}
- data.insert.Drive[ui.drives_buff] = ui.buff
+ data.insert.Drive[ui.drives_buff] = ui.buff.str
e_set_drive_keys(data)
ui.insert_sel_ok = false
ui.drives_buff = ""
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
} else {
e_readline(event, &ui.buff)
@@ -725,87 +725,87 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
case INS_SSH_HOST,
INS_RDP_HOST,
INS_OS_HOST:
- data.insert.Host = ui.buff
+ data.insert.Host = ui.buff.str
case INS_SSH_PORT,
INS_RDP_PORT:
- tmp, _ := strconv.Atoi(ui.buff)
+ tmp, _ := strconv.Atoi(ui.buff.str)
data.insert.Port = uint16(tmp)
case INS_SSH_USER,
INS_RDP_USER,
INS_OS_USER:
- data.insert.User = ui.buff
+ data.insert.User = ui.buff.str
case INS_SSH_PASS,
INS_RDP_PASS,
INS_OS_PASS:
- if len(ui.buff) == 0 {
+ if len(ui.buff.str) == 0 {
data.insert.Pass = ""
return true
} else {
- data.insert.Pass, _ = c_encrypt_str(ui.buff,
+ data.insert.Pass, _ = c_encrypt_str(ui.buff.str,
data.opts.GPG)
}
- case INS_SSH_PRIV: data.insert.Priv = ui.buff
- case INS_SSH_EXEC: data.insert.Exec = ui.buff
+ case INS_SSH_PRIV: data.insert.Priv = ui.buff.str
+ case INS_SSH_EXEC: data.insert.Exec = ui.buff.str
case INS_SSH_JUMP_HOST,
INS_RDP_JUMP_HOST + len(data.insert.Drive):
- data.insert.Jump.Host = ui.buff
- if len(ui.buff) > 0 {
+ data.insert.Jump.Host = ui.buff.str
+ if len(ui.buff.str) > 0 {
data.insert.Jump.Port = 22
} else {
data.insert.Jump.Port = 0
}
case INS_SSH_JUMP_PORT,
INS_RDP_JUMP_PORT + len(data.insert.Drive):
- tmp, _ := strconv.Atoi(ui.buff)
+ tmp, _ := strconv.Atoi(ui.buff.str)
data.insert.Jump.Port = uint16(tmp)
case INS_SSH_JUMP_USER,
INS_RDP_JUMP_USER + len(data.insert.Drive):
- data.insert.Jump.User = ui.buff
+ data.insert.Jump.User = ui.buff.str
case INS_SSH_JUMP_PASS,
INS_RDP_JUMP_PASS + len(data.insert.Drive):
- if len(ui.buff) == 0 {
+ if len(ui.buff.str) == 0 {
data.insert.Jump.Pass = ""
} else {
- data.insert.Jump.Pass, _ = c_encrypt_str(ui.buff,
+ data.insert.Jump.Pass, _ = c_encrypt_str(ui.buff.str,
data.opts.GPG)
}
case INS_SSH_JUMP_PRIV,
INS_RDP_JUMP_PRIV + len(data.insert.Drive):
- data.insert.Jump.Priv = ui.buff
+ data.insert.Jump.Priv = ui.buff.str
case INS_RDP_DOMAIN:
- data.insert.Domain = ui.buff
+ data.insert.Domain = ui.buff.str
case INS_RDP_FILE:
- data.insert.RDPFile = ui.buff
+ data.insert.RDPFile = ui.buff.str
case INS_CMD_CMD:
- data.insert.Host = ui.buff
+ data.insert.Host = ui.buff.str
case INS_CMD_SHELL:
- data.insert.Shell[0] = ui.buff
+ data.insert.Shell[0] = ui.buff.str
case INS_OS_USERDOMAINID:
- data.insert.Stack.UserDomainID = ui.buff
+ data.insert.Stack.UserDomainID = ui.buff.str
case INS_OS_PROJECTID:
- data.insert.Stack.ProjectID = ui.buff
+ data.insert.Stack.ProjectID = ui.buff.str
case INS_OS_REGION:
- data.insert.Stack.RegionName = ui.buff
+ data.insert.Stack.RegionName = ui.buff.str
case INS_OS_ENDTYPE:
- data.insert.Stack.EndpointType = ui.buff
+ data.insert.Stack.EndpointType = ui.buff.str
case INS_OS_INTERFACE:
- data.insert.Stack.Interface = ui.buff
+ data.insert.Stack.Interface = ui.buff.str
case INS_OS_IDAPI:
- data.insert.Stack.IdentityAPI = ui.buff
+ data.insert.Stack.IdentityAPI = ui.buff.str
case INS_OS_IMGAPI:
- data.insert.Stack.ImageAPI = ui.buff
+ data.insert.Stack.ImageAPI = ui.buff.str
case INS_OS_NETAPI:
- data.insert.Stack.NetworkAPI = ui.buff
+ data.insert.Stack.NetworkAPI = ui.buff.str
case INS_OS_VOLAPI:
- data.insert.Stack.VolumeAPI = ui.buff
+ data.insert.Stack.VolumeAPI = ui.buff.str
case INS_SSH_NOTE,
INS_RDP_NOTE + len(data.insert.Drive),
INS_CMD_NOTE,
INS_OS_NOTE:
- data.insert.Note = ui.buff
+ data.insert.Note = ui.buff.str
}
ui.insert_sel_ok = false
- ui.buff = ""
+ ui.buff.str = ""
ui.s.HideCursor()
} else {
e_readline(event, &ui.buff)
@@ -823,7 +823,7 @@ func e_rename_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
} else if event.Key() == tcell.KeyEnter {
if err := e_rename(data, ui); err != nil {
ui.s.HideCursor()
- ui.buff = ""
+ ui.buff.str = ""
return true
}
} else {
@@ -832,7 +832,7 @@ func e_rename_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
}
ui.s.HideCursor()
ui.mode = NORMAL_MODE
- ui.buff = ""
+ ui.buff.str = ""
return false
}