Mercurial > cgi-bin > hgweb.cgi > PassMan
annotate src/main/kotlin/name/blackcap/passman/HelpSubcommand.kt @ 27:3a3067ba673b
Add idle-time detection to interactive mode, clean up imports.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sat, 27 Jul 2024 09:50:54 -0700 |
parents | 2188b2f13326 |
children |
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 | 18 println("export Export to CSV file.") |
12 | 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 | 22 println("password Change database encryption key.") |
22 | 23 println("quit Exit from interactive mode.") |
11 | 24 println("read Retrieve data from existing record.") |
25 println("rename Rename existing record.") | |
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 | 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 | 34 } |