From 6c0322601cf55b6955a064294ecd22a830501d56 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 1 Feb 2026 22:12:36 -0500 Subject: [PATCH] Simplify LibmuttonInit implementation --- core.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core.go b/core.go index e0fe3bb..b7316e5 100644 --- a/core.go +++ b/core.go @@ -81,21 +81,20 @@ func GetOldEntryData(realPath C.PascalString, field int, rcwPassword C.PascalStr // An array of ordered responses to inputCB questions. // //export LibmuttonInit -func LibmuttonInit(inputCBResponses C.PascalStringArray, rcwPassword C.PascalString, appendMode bool, forceOfflineMode bool, deviceIDPrefix C.PascalString) *C.char { - inputCBRespSlice := getStringSliceFromCPascalStringArray(inputCBResponses) +func LibmuttonInit(configSSH, sshKeyPath, sshKeyProtected, sshUser, sshHost, sshPort, rcwPassword C.PascalString, appendMode bool, forceOfflineMode bool, deviceIDPrefix C.PascalString) *C.char { supplyInputForInit := func(prompt string) string { if strings.HasPrefix(prompt, "Configure SSH settings (for synchronization)? (Y/n)") { - return inputCBRespSlice[0] + return C.GoStringN(configSSH.data, configSSH.len) } else if strings.HasPrefix(prompt, "SSH private identity file path (falls back to") { - return inputCBRespSlice[1] + return C.GoStringN(sshKeyPath.data, sshKeyPath.len) } else if strings.HasPrefix(prompt, "Is the identity file password-protected? (y/N)") { - return inputCBRespSlice[2] + return C.GoStringN(sshKeyProtected.data, sshKeyProtected.len) } else if strings.HasPrefix(prompt, "Remote SSH username:") { - return inputCBRespSlice[3] + return C.GoStringN(sshUser.data, sshUser.len) } else if strings.HasPrefix(prompt, "Remote SSH IP/domain:") { - return inputCBRespSlice[4] + return C.GoStringN(sshHost.data, sshHost.len) } else if strings.HasPrefix(prompt, "Remote SSH port:") { - return inputCBRespSlice[5] + return C.GoStringN(sshPort.data, sshPort.len) } return "" }