comparison src/main/kotlin/name/blackcap/passman/ListSubcommand.kt @ 8:698c4a3d758d

Some code clean-up.
author David Barts <n5jrn@me.com>
date Fri, 23 Sep 2022 20:59:52 -0700
parents f245b9a53495
children 72619175004e
comparison
equal deleted inserted replaced
7:f245b9a53495 8:698c4a3d758d
61 } 61 }
62 if (commandLine.hasOption(HELP)) { 62 if (commandLine.hasOption(HELP)) {
63 HelpFormatter().printHelp("$SHORTNAME list", options) 63 HelpFormatter().printHelp("$SHORTNAME list", options)
64 exitProcess(0) 64 exitProcess(0)
65 } 65 }
66 if (commandLine.args.isNotEmpty()) {
67 error("unexpected trailing arguments")
68 }
66 69
67 STRING_OPTIONS.forEach { 70 STRING_OPTIONS.forEach {
68 commandLine.getOptionValues(it.name)?.forEach { value -> 71 commandLine.getOptionValues(it.name)?.forEach { value ->
69 val regexOptions = mutableSetOf<RegexOption>() 72 val regexOptions = mutableSetOf<RegexOption>()
70 if (commandLine.hasOption(FIXED)) { 73 if (commandLine.hasOption(FIXED)) {
120 val results = it.executeQuery() 123 val results = it.executeQuery()
121 val printer = if (commandLine.hasOption(LONG)) Entry::printLong else Entry::print 124 val printer = if (commandLine.hasOption(LONG)) Entry::printLong else Entry::print
122 var count = 0; 125 var count = 0;
123 while (results.next()) { 126 while (results.next()) {
124 val entry = Entry( 127 val entry = Entry(
125 name = results.getDecryptedString(1, db.encryption), 128 name = results.getDecryptedString(1, db.encryption)!!,
126 username = results.getDecryptedString(2, db.encryption), 129 username = results.getDecryptedString(2, db.encryption)!!,
127 password = REDACTED, 130 password = REDACTED,
128 notes = results.getDecryptedString(3, db.encryption), 131 notes = results.getDecryptedString(3, db.encryption),
129 created = results.getDate(4), 132 created = results.getDate(4),
130 modified = results.getDate(5), 133 modified = results.getDate(5),
131 accessed = results.getDate(6) 134 accessed = results.getDate(6)