annotate src/main/kotlin/name/blackcap/passman/HelpSubcommand.kt @ 24:2188b2f13326

Make some minor tweaks to the help system.
author David Barts <n5jrn@me.com>
date Wed, 03 Jul 2024 17:14:22 -0700
parents 07406c4af4a5
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 class HelpSubcommand(): Subcommand() {
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 override fun run(args: Array<String>) {
24
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
5 if (args.isEmpty() || args[0] == "-h" || args[0].startsWith("--h")) {
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
6 listSubcommands()
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
7 } else {
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
8 helpForSubcommand(args[0])
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
9 }
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
10 }
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
11
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
12 private fun listSubcommands() {
0
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 println("PassMan: a password manager")
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
14 println("Available subcommands:")
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
15 println("create Create a new username/password pair.")
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 println("delete Delete existing record.")
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 println("help Print this message.")
16
7a74ae668665 Add export subcommand.
David Barts <n5jrn@me.com>
parents: 15
diff changeset
18 println("export Export to CSV file.")
12
a38a2a1036c3 Add import subcommand.
David Barts <n5jrn@me.com>
parents: 11
diff changeset
19 println("import Import from CSV file.")
0
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 println("list List records.")
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
21 println("merge Merge passwords in from another PassMan database.")
15
0fc90892a3ae Add password subcommand.
David Barts <n5jrn@me.com>
parents: 13
diff changeset
22 println("password Change database encryption key.")
22
07406c4af4a5 More interactive mode stuff.
David Barts <n5jrn@me.com>
parents: 16
diff changeset
23 println("quit Exit from interactive mode.")
11
c69665ff37d0 Add merge subcommand (untested).
David Barts <n5jrn@me.com>
parents: 8
diff changeset
24 println("read Retrieve data from existing record.")
c69665ff37d0 Add merge subcommand (untested).
David Barts <n5jrn@me.com>
parents: 8
diff changeset
25 println("rename Rename existing record.")
c69665ff37d0 Add merge subcommand (untested).
David Barts <n5jrn@me.com>
parents: 8
diff changeset
26 println("update Update existing record.")
13
302d224bbd57 Improve help messages and csv error reportage.
David Barts <n5jrn@me.com>
parents: 12
diff changeset
27 println()
15
0fc90892a3ae Add password subcommand.
David Barts <n5jrn@me.com>
parents: 13
diff changeset
28 println("Database is ${see(DB_FILE)} .")
0
a6cfdffcaa94 Initial commit, incomplete but it runs sorta.
David Barts <n5jrn@me.com>
parents:
diff changeset
29 }
24
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
30
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
31 private fun helpForSubcommand(subcom: String) {
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
32 runSubcommand(subcom, arrayOf<String>("--help"))
2188b2f13326 Make some minor tweaks to the help system.
David Barts <n5jrn@me.com>
parents: 22
diff changeset
33 }
8
698c4a3d758d Some code clean-up.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
34 }