comparison src/main/kotlin/name/blackcap/passman/CreateSubcommand.kt @ 3:eafa3779aef8

More bug fixes, quote strings in diagnostics.
author David Barts <n5jrn@me.com>
date Sun, 11 Sep 2022 20:36:06 -0700
parents a6cfdffcaa94
children 711cc42e96d7
comparison
equal deleted inserted replaced
2:3c792ad36b3d 3:eafa3779aef8
27 val entry = if (commandLine.hasOption("generate")) { 27 val entry = if (commandLine.hasOption("generate")) {
28 val rawLength = commandLine.getOptionValue("length") 28 val rawLength = commandLine.getOptionValue("length")
29 val length = try { 29 val length = try {
30 rawLength?.toInt() ?: DEFAULT_GENERATED_LENGTH 30 rawLength?.toInt() ?: DEFAULT_GENERATED_LENGTH
31 } catch (e: NumberFormatException) { 31 } catch (e: NumberFormatException) {
32 die("$rawLength - invalid length") 32 die("${see(rawLength)} - invalid length")
33 -1 /* will never happen */ 33 -1 /* will never happen */
34 } 34 }
35 val symbols = commandLine.hasOption("symbols") 35 val symbols = commandLine.hasOption("symbols")
36 val verbose = commandLine.hasOption("verbose") 36 val verbose = commandLine.hasOption("verbose")
37 Entry.withGeneratedPassword(length, symbols, verbose) 37 Entry.withGeneratedPassword(length, symbols, verbose)
44 it.setLong(1, id) 44 it.setLong(1, id)
45 val result = it.executeQuery() 45 val result = it.executeQuery()
46 result.next() 46 result.next()
47 val count = result.getInt(1) 47 val count = result.getInt(1)
48 if (count > 0) { 48 if (count > 0) {
49 die("record matching ${entry.name} already exists") 49 die("record matching ${see(entry.name)} already exists")
50 } 50 }
51 } 51 }
52 52
53 try { 53 try {
54 if (entry.notes.isBlank()) { 54 if (entry.notes.isBlank()) {