comparison src/main/kotlin/name/blackcap/passman/Main.kt @ 24:2188b2f13326

Make some minor tweaks to the help system.
author David Barts <n5jrn@me.com>
date Wed, 03 Jul 2024 17:14:22 -0700
parents af86b8e0b88c
children 3a3067ba673b
comparison
equal deleted inserted replaced
23:af86b8e0b88c 24:2188b2f13326
7 import kotlin.reflect.jvm.javaMethod 7 import kotlin.reflect.jvm.javaMethod
8 import kotlin.reflect.jvm.kotlinFunction 8 import kotlin.reflect.jvm.kotlinFunction
9 import kotlin.system.exitProcess 9 import kotlin.system.exitProcess
10 10
11 fun main(args: Array<String>) { 11 fun main(args: Array<String>) {
12 val NOPASSWORD = setOf<String>("help") 12 val NOPASSWORD = setOf<String>("help", "quit")
13 if (args.isEmpty()) { 13 if (args.isEmpty()) {
14 openDatabase() 14 openDatabase()
15 runInteractive() 15 runInteractive()
16 } 16 }
17 val subcommand = args[0] 17 val subcommand = args[0]
46 46
47 fun runInteractive() { 47 fun runInteractive() {
48 val DISALLOWED = setOf<String>("password") 48 val DISALLOWED = setOf<String>("password")
49 val QUIT = setOf<String>("exit", "quit") 49 val QUIT = setOf<String>("exit", "quit")
50 var lastStatus = 0 50 var lastStatus = 0
51 println("This is PassMan interactive mode. Type help for help.")
51 while (true) { 52 while (true) {
52 val rawLine = System.console()?.readLine("passman> ") 53 val rawLine = System.console()?.readLine("passman> ")
53 if (rawLine == null) { 54 if (rawLine == null) {
54 println() // ensure shell prompt comes out on a line of its own 55 println() // ensure shell prompt comes out on a line of its own
55 break 56 break