mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-02 23:27:22 -04:00
Expand "~" to home directory when specifying ssh identity file
This commit is contained in:
+4
-3
@@ -2,10 +2,11 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rwinkhart/MUTN/src/backend"
|
|
||||||
"github.com/rwinkhart/MUTN/src/sync"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/rwinkhart/MUTN/src/backend"
|
||||||
|
"github.com/rwinkhart/MUTN/src/sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TempInitCli initializes the MUTN environment based on user input (will be replaced with a TUI menu)
|
// TempInitCli initializes the MUTN environment based on user input (will be replaced with a TUI menu)
|
||||||
@@ -36,7 +37,7 @@ func TempInitCli() {
|
|||||||
sshUser := input("Remote SSH username:")
|
sshUser := input("Remote SSH username:")
|
||||||
sshPort := input("Remote SSH port:")
|
sshPort := input("Remote SSH port:")
|
||||||
sshIP := input("Remote SSH IP/domain:")
|
sshIP := input("Remote SSH IP/domain:")
|
||||||
sshKey := input("SSH private identity file path:") // TODO implement generator and selector
|
sshKey := expandPathWithHome(input("SSH private identity file path:")) // TODO implement generator and selector
|
||||||
sshKeyProtected := inputBinary("Is the identity file password-protected?")
|
sshKeyProtected := inputBinary("Is the identity file password-protected?")
|
||||||
|
|
||||||
// initialize libmutton directories
|
// initialize libmutton directories
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package cli
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rwinkhart/MUTN/src/backend"
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rwinkhart/MUTN/src/backend"
|
||||||
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// input prompts the user for input and returns the input as a string
|
// input prompts the user for input and returns the input as a string
|
||||||
@@ -76,3 +77,8 @@ func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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, "~", backend.Home, 1)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user