annotate src/main/kotlin/name/blackcap/passman/Subcommand.kt @ 23:af86b8e0b88c

Clean up exit output.
author David Barts <n5jrn@me.com>
date Tue, 02 Jul 2024 18:18:29 -0700
parents ea65ab890f66
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 package name.blackcap.passman
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
2
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 abstract class Subcommand() {
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 abstract fun run(args: Array<String>): Unit
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
5 }
21
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
6
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
7 // Replaces fatal errors that used to exit the process.
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
8 class SubcommandException(message: String? = null, cause: Throwable? = null, status: Int = 1) : Exception(message, cause) {
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
9 private val _status = status
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
10 val status: Int
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
11 get() = _status
ea65ab890f66 More work to support interactive feature.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
12 }