From 971556aabc3833e0457b23bc6bbf5cc1088bb8b2 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Wed, 29 May 2024 13:23:08 -0400 Subject: [PATCH] Reorganize function parameters to not specify repeat types --- src/backend/copy.go | 6 +++--- src/backend/copyDARWIN.go | 2 +- src/backend/copyTERMUX.go | 2 +- src/backend/copyUNIXGeneric.go | 2 +- src/backend/copyWIN.go | 2 +- src/backend/edit.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/copy.go b/src/backend/copy.go index cb3cf75..7c70913 100644 --- a/src/backend/copy.go +++ b/src/backend/copy.go @@ -11,7 +11,7 @@ import ( ) // CopyArgument copies a field from an entry to the clipboard -func CopyArgument(targetLocation string, field int, executableName string) { +func CopyArgument(executableName, targetLocation string, field int) { if isFile, _ := TargetIsFile(targetLocation, true, 2); isFile { decryptedEntry := DecryptGPG(targetLocation) @@ -41,7 +41,7 @@ func CopyArgument(targetLocation string, field int, executableName string) { for { // keep field copied to clipboard, refresh on 30-second intervals currentTime := time.Now() - copyField(GenTOTP(secret, currentTime, forSteam), "") + copyField("", GenTOTP(secret, currentTime, forSteam)) // sleep until next 30-second interval time.Sleep(time.Duration(30-(currentTime.Second()%30)) * time.Second) } @@ -52,7 +52,7 @@ func CopyArgument(targetLocation string, field int, executableName string) { } // copy field to clipboard, launch clipboard clearing process - copyField(copySubject, executableName) + copyField(executableName, copySubject) } } diff --git a/src/backend/copyDARWIN.go b/src/backend/copyDARWIN.go index 27eac2f..4633175 100644 --- a/src/backend/copyDARWIN.go +++ b/src/backend/copyDARWIN.go @@ -13,7 +13,7 @@ import ( // TODO MacOS support is entirely untested - I would appreciate feedback on this implementation // copyField copies a field from an entry to the clipboard -func copyField(copySubject string, executableName string) { +func copyField(executableName, copySubject string) { cmd := exec.Command("pbcopy") writeToStdin(cmd, copySubject) err := cmd.Run() diff --git a/src/backend/copyTERMUX.go b/src/backend/copyTERMUX.go index 7d37111..662e8b1 100644 --- a/src/backend/copyTERMUX.go +++ b/src/backend/copyTERMUX.go @@ -11,7 +11,7 @@ import ( ) // copyField copies a field from an entry to the clipboard -func copyField(copySubject string, executableName string) { +func copyField(executableName, copySubject string) { cmd := exec.Command("termux-clipboard-set") writeToStdin(cmd, copySubject) err := cmd.Run() diff --git a/src/backend/copyUNIXGeneric.go b/src/backend/copyUNIXGeneric.go index 01a0221..f6c7bff 100644 --- a/src/backend/copyUNIXGeneric.go +++ b/src/backend/copyUNIXGeneric.go @@ -11,7 +11,7 @@ import ( ) // copyField copies a field from an entry to the clipboard -func copyField(copySubject string, executableName string) { +func copyField(executableName, copySubject string) { var envSet bool // track whether environment variables are set var cmd *exec.Cmd // determine whether to use wl-copy (Wayland) or xclip (X11) diff --git a/src/backend/copyWIN.go b/src/backend/copyWIN.go index 952f32a..ae912de 100644 --- a/src/backend/copyWIN.go +++ b/src/backend/copyWIN.go @@ -11,7 +11,7 @@ import ( ) // copyField copies a field from an entry to the clipboard -func copyField(copySubject string, executableName string) { +func copyField(executableName, copySubject string) { cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", strings.ReplaceAll(copySubject, "'", "''"))) err := cmd.Run() if err != nil { diff --git a/src/backend/edit.go b/src/backend/edit.go index 714a49f..726a6b0 100644 --- a/src/backend/edit.go +++ b/src/backend/edit.go @@ -22,7 +22,7 @@ func GetOldEntryData(targetLocation string, field int) []string { } // Rename renames oldLocation to newLocation -func Rename(oldLocation string, newLocation string) { +func Rename(oldLocation, newLocation string) { // ensure newLocation does not exist _, isAccessible := TargetIsFile(newLocation, false, 0) if isAccessible {