view src/main/kotlin/name/blackcap/passman/Ask.kt @ 26:69526ae8c8de

Allow list --name to be abbreviated -n, since it is so commonly used.
author David Barts <n5jrn@me.com>
date Fri, 05 Jul 2024 10:11:31 -0700
parents a38a2a1036c3
children
line wrap: on
line source

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')
}