diff src/main/kotlin/name/blackcap/passman/Ask.kt @ 12:a38a2a1036c3

Add import subcommand.
author David Barts <n5jrn@me.com>
date Sun, 22 Jan 2023 09:22:53 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/kotlin/name/blackcap/passman/Ask.kt	Sun Jan 22 09:22:53 2023 -0800
@@ -0,0 +1,14 @@
+package name.blackcap.passman
+
+fun askUserIfOkToOverwrite(thisEntry: Entry, otherEntry: Entry): Boolean {
+    val REDACTED = "(redacted)"
+    println("EXISTING ENTRY:")
+    thisEntry.printLong(REDACTED)
+    println()
+    println("NEWER ENTRY:")
+    otherEntry.printLong(REDACTED)
+    println()
+    val answer = name.blackcap.passman.readLine("OK to overwrite existing entry? ")
+    println()
+    return answer.trimStart().firstOrNull()?.uppercaseChar() in setOf('T', 'Y')
+}