Move expandPathWithHome to libmutton

This commit is contained in:
2025-01-16 14:26:57 -05:00
parent d1d88c2e69
commit 118ffc2adb
4 changed files with 4 additions and 9 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ func TempInitCli() {
var sshKeyIsFile bool
for !sshKeyIsFile {
fallbackSSHKey := core.Home + core.PathSeparator + ".ssh" + core.PathSeparator + "id_ed25519"
sshKey = cmp.Or(expandPathWithHome(input("SSH private identity file path (falls back to \""+fallbackSSHKey+"\"):")), fallbackSSHKey)
sshKey = cmp.Or(core.ExpandPathWithHome(input("SSH private identity file path (falls back to \""+fallbackSSHKey+"\"):")), fallbackSSHKey)
sshKeyIsFile, _ = core.TargetIsFile(sshKey, false, 0)
if !sshKeyIsFile {
fmt.Println(core.AnsiError+"SSH identity file not found:", sshKey+core.AnsiReset)
-5
View File
@@ -78,11 +78,6 @@ func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets
}
}
// expandPathWithHome, given a path (as a string) containing "~", returns the path with "~" expanded to the user's home directory.
func expandPathWithHome(path string) string {
return strings.Replace(path, "~", core.Home, 1)
}
// RunJobWrapper is a wrapper for sync.RunJob that sets the passphrase input function to inputHidden.
func RunJobWrapper(manualSync bool) {
core.PassphraseInputFunction = inputHidden