From 35db3bf20b8ab3705bf349fdc7ed4b8e7899cddb Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 11 Dec 2025 19:34:05 -0500 Subject: [PATCH] Rename syncclient "oneOff" functions to be less redundant --- core/init.go | 2 +- core/util.go | 2 +- syncclient/oneOff.go | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/init.go b/core/init.go index 2b6d5da..e751fab 100644 --- a/core/init.go +++ b/core/init.go @@ -80,7 +80,7 @@ func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData [][ return errors.New("unable to write config file: " + err.Error()) } // generate and register device ID - sshEntryRoot, sshAgeDir, sshIsWindows, err := syncclient.DeviceIDGenFromClient(oldDeviceID, "") + sshEntryRoot, sshAgeDir, sshIsWindows, err := syncclient.GenDeviceID(oldDeviceID, "") if err != nil { return errors.New("unable to generate device ID: " + err.Error()) } diff --git a/core/util.go b/core/util.go index 7e9951a..ec6972a 100644 --- a/core/util.go +++ b/core/util.go @@ -33,7 +33,7 @@ func WriteEntry(realPath string, decSlice []string, passwordIsNew bool) error { return errors.New("unable to update age data: " + err.Error()) } } else { // if the password change was a removal, remove the associated age file - err = syncclient.ShearRemoteFromClient(global.GetVanityPath(realPath), true) + err = syncclient.ShearRemote(global.GetVanityPath(realPath), true) if err != nil { return errors.New("unable to remove age data: " + err.Error()) } diff --git a/syncclient/oneOff.go b/syncclient/oneOff.go index d2522ad..105c5c7 100644 --- a/syncclient/oneOff.go +++ b/syncclient/oneOff.go @@ -15,13 +15,13 @@ import ( "github.com/rwinkhart/libmutton/synccommon" ) -// ShearRemoteFromClient removes the target file or directory from +// ShearRemote removes the target file or directory from // the local system and calls the server to remove it remotely and // add it to the deletions list. // It can safely be called in offline mode, as well, so this is // the intended interface for shearing (ShearLocal should only // be used directly by the server binary). -func ShearRemoteFromClient(vanityPath string, onlyShearAgeFile bool) error { +func ShearRemote(vanityPath string, onlyShearAgeFile bool) error { deviceID, isDir, err := synccommon.ShearLocal(vanityPath, "", onlyShearAgeFile) // remove the target from the local system and get the device ID of the client if err != nil { return errors.New("unable to shear target locally: " + err.Error()) @@ -73,7 +73,7 @@ end: // old target to the deletions list. // It can safely be called in offline mode, as well, so this is the intended // interface for renaming (RenameLocal should only be used directly by the server binary). -func RenameRemoteFromClient(oldVanityPath, newVanityPath string) error { +func RenameRemote(oldVanityPath, newVanityPath string) error { err := synccommon.RenameLocal(oldVanityPath, newVanityPath) // move the target on the local system if err != nil { return errors.New("unable to rename target locally: " + err.Error()) @@ -125,7 +125,7 @@ end: // It can safely be called in offline mode, as well, so this is the // intended interface for adding folders (AddFolderLocal should only be // used directly by the server binary). -func AddFolderRemoteFromClient(vanityPath string) error { +func AddFolderRemote(vanityPath string) error { err := synccommon.AddFolderLocal(vanityPath) // add the folder on the local system if err != nil { return errors.New("unable to add folder locally: " + err.Error()) @@ -161,13 +161,13 @@ end: return nil } -// DeviceIDGenFromClient generates a new client device ID +// GenDeviceID generates a new client device ID // and registers it with the server (will replace existing one). // Device IDs are only needed for online synchronization. // Device IDs are guaranteed unique as the current UNIX time is appended to them. // Leave prefix empty to use the current hostname as the prefix. // Returns: the remote EntryRoot, the remote AgeDir, and OS type indicator. -func DeviceIDGenFromClient(oldDeviceID, prefix string) (string, string, string, error) { +func GenDeviceID(oldDeviceID, prefix string) (string, string, string, error) { // generate new device ID if prefix == "" { prefix, _ = os.Hostname()