mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Promote native sync to replace sshyp-based sync on all platforms
This commit is contained in:
@@ -2,6 +2,7 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/rwinkhart/MUTN/src/sync"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -13,7 +14,7 @@ import (
|
||||
const ansiShownPassword = "\033[38;5;10m"
|
||||
|
||||
// EntryReader prints the decrypted contents of a libmutton entry in a human-readable format
|
||||
func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
||||
func EntryReader(decryptedEntry []string, hidePassword bool, syncEnabled bool) {
|
||||
fmt.Println()
|
||||
|
||||
for i := range decryptedEntry {
|
||||
@@ -57,17 +58,17 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
||||
}
|
||||
}
|
||||
|
||||
if sync && !backend.IsWindows {
|
||||
SshypSync() // TODO Remove after native sync is implemented
|
||||
if syncEnabled {
|
||||
sync.RunJob(false)
|
||||
}
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// EntryReaderDecrypt is a wrapper for EntryReader that first decrypts a GPG-encrypted file before sending it to EntryReader
|
||||
func EntryReaderDecrypt(targetLocation string, hidePassword bool, sync bool) {
|
||||
func EntryReaderDecrypt(targetLocation string, hidePassword bool) {
|
||||
if isFile, _ := backend.TargetIsFile(targetLocation, true, 2); isFile {
|
||||
EntryReader(backend.DecryptGPG(targetLocation), hidePassword, sync)
|
||||
EntryReader(backend.DecryptGPG(targetLocation), hidePassword, false) // never sync if decrypting straight to EntryReader, as this means the entry could not have been modified
|
||||
}
|
||||
// do not exit, as this is the job of EntryReader
|
||||
}
|
||||
|
||||
@@ -6,17 +6,9 @@ import (
|
||||
"github.com/rwinkhart/MUTN/src/backend"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TODO remove after native sync is implemented
|
||||
func SshypSync() {
|
||||
cmd := exec.Command("sshyp", "sync")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Run()
|
||||
}
|
||||
|
||||
// input prompts the user for input and returns the input as a string
|
||||
func input(prompt string) string {
|
||||
fmt.Print("\n" + prompt + " ")
|
||||
|
||||
Reference in New Issue
Block a user