Mercurial > cgi-bin > hgweb.cgi > PassMan
diff 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 |
line wrap: on
line diff
--- a/src/main/kotlin/name/blackcap/passman/HelpSubcommand.kt Tue Jul 02 18:18:29 2024 -0700 +++ b/src/main/kotlin/name/blackcap/passman/HelpSubcommand.kt Wed Jul 03 17:14:22 2024 -0700 @@ -2,6 +2,14 @@ class HelpSubcommand(): Subcommand() { override fun run(args: Array<String>) { + if (args.isEmpty() || args[0] == "-h" || args[0].startsWith("--h")) { + listSubcommands() + } else { + helpForSubcommand(args[0]) + } + } + + private fun listSubcommands() { println("PassMan: a password manager") println("Available subcommands:") println("create Create a new username/password pair.") @@ -19,4 +27,8 @@ println() println("Database is ${see(DB_FILE)} .") } + + private fun helpForSubcommand(subcom: String) { + runSubcommand(subcom, arrayOf<String>("--help")) + } }