annotate src/main/kotlin/name/blackcap/passman/Ask.kt @ 27:3a3067ba673b

Add idle-time detection to interactive mode, clean up imports.
author David Barts <n5jrn@me.com>
date Sat, 27 Jul 2024 09:50:54 -0700
parents a38a2a1036c3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 package name.blackcap.passman
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
2
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 fun askUserIfOkToOverwrite(thisEntry: Entry, otherEntry: Entry): Boolean {
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 val REDACTED = "(redacted)"
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
5 println("EXISTING ENTRY:")
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
6 thisEntry.printLong(REDACTED)
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 println()
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
8 println("NEWER ENTRY:")
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 otherEntry.printLong(REDACTED)
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 println()
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
11 val answer = name.blackcap.passman.readLine("OK to overwrite existing entry? ")
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
12 println()
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 return answer.trimStart().firstOrNull()?.uppercaseChar() in setOf('T', 'Y')
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents:
diff changeset
14 }