Remove error messages that do not make sense for GUI implementations

This commit is contained in:
2025-02-01 19:31:24 -05:00
parent 4689cae3f4
commit 173574eb85
4 changed files with 6 additions and 18 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ func GetSSHClient(manualSync bool) (*ssh.Client, string, bool) {
var sshUserConfig []string var sshUserConfig []string
var missingValueError string var missingValueError string
if manualSync { if manualSync {
missingValueError = joinErrorWithEXE("SSH settings not configured - Run \"", " init\" to configure") missingValueError = core.AnsiError + "SSH settings not fully configured" + core.AnsiReset
} else { } else {
missingValueError = "0" // allow silent exit at this point in offline mode missingValueError = "0" // allow silent exit at this point in offline mode
} }
@@ -140,7 +140,7 @@ func getRemoteDataFromClient(sshClient *ssh.Client, manualSync bool) (map[string
deviceIDList := core.GenDeviceIDList(true) deviceIDList := core.GenDeviceIDList(true)
if len(*deviceIDList) == 0 { if len(*deviceIDList) == 0 {
if manualSync { if manualSync {
fmt.Println(joinErrorWithEXE("Sync failed - No device ID found; run \"", " init\" to generate a device ID")) fmt.Println(core.AnsiError + "Sync failed - No device ID found" + core.AnsiReset)
os.Exit(core.ErrorTargetNotFound) os.Exit(core.ErrorTargetNotFound)
} else { } else {
core.Exit(0) // exit silently if the sync job was called automatically, as the user may just be in offline mode core.Exit(0) // exit silently if the sync job was called automatically, as the user may just be in offline mode
+1 -6
View File
@@ -25,7 +25,7 @@ func WalkEntryDir() ([]string, []string) {
// check for errors encountered while walking directory // check for errors encountered while walking directory
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
fmt.Println(core.AnsiError+"The entry directory does not exist - Run \""+os.Args[0], "init"+"\" to create it"+core.AnsiReset) fmt.Println(core.AnsiError + "The entry directory does not exist - Initialize libmutton to create it" + core.AnsiReset)
} else { } else {
// otherwise, print the source of the error // otherwise, print the source of the error
fmt.Println(core.AnsiError+"An unexpected error occurred while generating the entry list:", err.Error()+core.AnsiReset) fmt.Println(core.AnsiError+"An unexpected error occurred while generating the entry list:", err.Error()+core.AnsiReset)
@@ -48,8 +48,3 @@ func WalkEntryDir() ([]string, []string) {
return fileList, dirList return fileList, dirList
} }
// joinErrorWithEXE is a utility function that joins and returns the two strings it is provided (in error format) with the executable name inserted between them.
func joinErrorWithEXE(firstHalf, secondHalf string) string {
return core.AnsiError + firstHalf + os.Args[0] + secondHalf + core.AnsiReset
}
+1 -6
View File
@@ -26,7 +26,7 @@ func WalkEntryDir() ([]string, []string) {
// check for errors encountered while walking directory // check for errors encountered while walking directory
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
fmt.Println(joinErrorWithEXE("The entry directory does not exist - Run \"", " init"+"\" to create it")) fmt.Println(core.AnsiError + "The entry directory does not exist - Initialize libmutton to create it" + core.AnsiReset)
} else { } else {
// otherwise, print the source of the error // otherwise, print the source of the error
fmt.Println(core.AnsiError+"An unexpected error occurred while generating the entry list:", err.Error()+core.AnsiReset) fmt.Println(core.AnsiError+"An unexpected error occurred while generating the entry list:", err.Error()+core.AnsiReset)
@@ -49,8 +49,3 @@ func WalkEntryDir() ([]string, []string) {
return fileList, dirList return fileList, dirList
} }
// joinErrorWithEXE is a utility function that joins and returns the two strings it is provided (in error format) with the executable name inserted between them.
func joinErrorWithEXE(firstHalf, secondHalf string) string {
return core.AnsiError + firstHalf + os.Args[0][strings.LastIndex(os.Args[0], "\\")+1:] + secondHalf + core.AnsiReset
}
+2 -4
View File
@@ -18,10 +18,8 @@ These are as follows:
## Required Global Variable Manipulation ## Required Global Variable Manipulation
libmutton provides a `PassphraseInputFunction` global variable that all clients must set to support passphrase-protected SSH identity files. This approach allows for different types of clients (CLI, GUI, TUI) to prompt for the passphrase in the most appropriate way. libmutton provides a `PassphraseInputFunction` global variable that all clients must set to support passphrase-protected SSH identity files. This approach allows for different types of clients (CLI, GUI, TUI) to prompt for the passphrase in the most appropriate way.
## Required Arguments ## Required Argument (clipclear)
Some arguments should be accepted by all/most libmutton-based password managers. These are as follows: The `clipclear` argument should be accepted by all non-interactive CLI libmutton implementations (not required for interactive GUI/TUI implementations). In order to clear the clipboard on a timer, non-interactive libmutton-based password managers call another instance of their executable with the `clipclear` argument (e.g. `mutn clipclear`) with the intended clipboard contents provided via STDIN. If after 30 seconds the clipboard contents have not changed, they are cleared. Please accept a `clipclear` argument that calls `core.ClipClearArgument()`.
- `clipclear`: This argument is required for correct functionality of non-interactive CLI implementations (not needed for interactive GUI/TUI implementations). In order to clear the clipboard on a timer, libmutton-based password managers call another instance of their executable with the `clipclear` argument (e.g. `mutn clipclear`) with the intended clipboard contents provided via STDIN. If after 30 seconds the clipboard contents have not changed, they are cleared. Please accept a `clipclear` argument that calls `core.ClipClearArgument()`.
- `init`: This argument is optional, but recommended for CLI interfaces. Some error messages request the user to use the `init` argument to fix configuration issues. If the argument does not exist, this may confuse the user.
## Configuration ## Configuration
libmutton-based password manager clients should all share the same INI configuration file. libmutton-based password manager clients should all share the same INI configuration file.