diff src/main/kotlin/name/blackcap/passman/CreateSubcommand.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 cbe4c797c9a6
line wrap: on
line diff
--- a/src/main/kotlin/name/blackcap/passman/CreateSubcommand.kt	Fri Sep 23 20:59:52 2022 -0700
+++ b/src/main/kotlin/name/blackcap/passman/CreateSubcommand.kt	Sat Oct 01 09:57:23 2022 -0700
@@ -27,7 +27,7 @@
             die(e.message ?: "syntax error", 2)
         }
         if (commandLine.hasOption(HELP)) {
-            HelpFormatter().printHelp("$SHORTNAME create", options)
+            HelpFormatter().printHelp("$SHORTNAME create [options]", options)
             exitProcess(0)
         }
         checkArguments()
@@ -97,11 +97,11 @@
                 }
             }
         }
-        if (commandLine.args.isNotEmpty()) {
-            error("unexpected trailing arguments")
-        }
         if (bad) {
             exitProcess(2);
         }
+        if (commandLine.args.isNotEmpty()) {
+            die("unexpected trailing arguments", 2)
+        }
     }
 }