Mercurial > cgi-bin > hgweb.cgi > PassMan
comparison src/main/kotlin/name/blackcap/passman/UpdateSubcommand.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 | 3c792ad36b3d |
children | 711cc42e96d7 |
comparison
equal
deleted
inserted
replaced
2:3c792ad36b3d | 3:eafa3779aef8 |
---|---|
51 id = db.makeKey(nameIn) | 51 id = db.makeKey(nameIn) |
52 length = commandLine.getOptionValue("length").let { rawLength -> | 52 length = commandLine.getOptionValue("length").let { rawLength -> |
53 try { | 53 try { |
54 rawLength?.toInt() ?: DEFAULT_GENERATED_LENGTH | 54 rawLength?.toInt() ?: DEFAULT_GENERATED_LENGTH |
55 } catch (e: NumberFormatException) { | 55 } catch (e: NumberFormatException) { |
56 die("$rawLength - invalid length") | 56 die("${see(rawLength)} - invalid length") |
57 -1 /* will never happen */ | 57 -1 /* will never happen */ |
58 } | 58 } |
59 } | 59 } |
60 generate = commandLine.hasOption("generate") | 60 generate = commandLine.hasOption("generate") |
61 allowSymbols = commandLine.hasOption("symbols") | 61 allowSymbols = commandLine.hasOption("symbols") |
88 it.setLong(1, id) | 88 it.setLong(1, id) |
89 val result = it.executeQuery() | 89 val result = it.executeQuery() |
90 result.next() | 90 result.next() |
91 val count = result.getInt(1) | 91 val count = result.getInt(1) |
92 if (count < 1) { | 92 if (count < 1) { |
93 die("no record matches $nameIn") | 93 die("no record matches " + see(nameIn)) |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 private fun update(): Unit { | 98 private fun update(): Unit { |