mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 16:47:20 -04:00
Move expandPathWithHome to libmutton
This commit is contained in:
@@ -5,7 +5,7 @@ go 1.23.4
|
|||||||
require (
|
require (
|
||||||
github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514
|
github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514
|
||||||
github.com/charmbracelet/glamour v0.7.0
|
github.com/charmbracelet/glamour v0.7.0
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20250116184730-89b74cec1e01
|
github.com/rwinkhart/libmutton v0.2.5-0.20250116192207-81b78068a75a
|
||||||
golang.org/x/term v0.28.0
|
golang.org/x/term v0.28.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
|||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM=
|
github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM=
|
||||||
github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw=
|
github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw=
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20250116184730-89b74cec1e01 h1:+1S0VkBSMhYYyr0L7ukFni7uxJhbas19bk2TsMd+qj0=
|
github.com/rwinkhart/libmutton v0.2.5-0.20250116192207-81b78068a75a h1:sN7Vq8j3AKUDIB3E1WOwSnZWWacuIJkvbWSVEOIRg0U=
|
||||||
github.com/rwinkhart/libmutton v0.2.5-0.20250116184730-89b74cec1e01/go.mod h1:kn7x0901qFyX1/HBxJf287zoySZkxKRMObKigLiI5Ok=
|
github.com/rwinkhart/libmutton v0.2.5-0.20250116192207-81b78068a75a/go.mod h1:kn7x0901qFyX1/HBxJf287zoySZkxKRMObKigLiI5Ok=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ func TempInitCli() {
|
|||||||
var sshKeyIsFile bool
|
var sshKeyIsFile bool
|
||||||
for !sshKeyIsFile {
|
for !sshKeyIsFile {
|
||||||
fallbackSSHKey := core.Home + core.PathSeparator + ".ssh" + core.PathSeparator + "id_ed25519"
|
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)
|
sshKeyIsFile, _ = core.TargetIsFile(sshKey, false, 0)
|
||||||
if !sshKeyIsFile {
|
if !sshKeyIsFile {
|
||||||
fmt.Println(core.AnsiError+"SSH identity file not found:", sshKey+core.AnsiReset)
|
fmt.Println(core.AnsiError+"SSH identity file not found:", sshKey+core.AnsiReset)
|
||||||
|
|||||||
@@ -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.
|
// RunJobWrapper is a wrapper for sync.RunJob that sets the passphrase input function to inputHidden.
|
||||||
func RunJobWrapper(manualSync bool) {
|
func RunJobWrapper(manualSync bool) {
|
||||||
core.PassphraseInputFunction = inputHidden
|
core.PassphraseInputFunction = inputHidden
|
||||||
|
|||||||
Reference in New Issue
Block a user