comparison src/main/kotlin/name/blackcap/passman/DeleteSubcommand.kt @ 9:72619175004e

Fix issues found in testing.
author David Barts <n5jrn@me.com>
date Sat, 01 Oct 2022 09:57:23 -0700
parents 698c4a3d758d
children ea65ab890f66
comparison
equal deleted inserted replaced
8:698c4a3d758d 9:72619175004e
4 4
5 class DeleteSubcommand(): Subcommand() { 5 class DeleteSubcommand(): Subcommand() {
6 override fun run(args: Array<String>) { 6 override fun run(args: Array<String>) {
7 if (args.isEmpty()) { 7 if (args.isEmpty()) {
8 die("expecting a site name", 2) 8 die("expecting a site name", 2)
9 }
10 if (args[0] == "-h" || args[0].startsWith("--h")) {
11 println("usage: passman delete name [...]")
12 exitProcess(0)
9 } 13 }
10 val db = Database.open() 14 val db = Database.open()
11 var errors = 0 15 var errors = 0
12 for (nameIn in args) { 16 for (nameIn in args) {
13 db.connection.prepareStatement("delete from passwords where id = ?").use { 17 db.connection.prepareStatement("delete from passwords where id = ?").use {