comparison 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
comparison
equal deleted inserted replaced
8:698c4a3d758d 9:72619175004e
25 commandLine = DefaultParser().parse(options, args) 25 commandLine = DefaultParser().parse(options, args)
26 } catch (e: ParseException) { 26 } catch (e: ParseException) {
27 die(e.message ?: "syntax error", 2) 27 die(e.message ?: "syntax error", 2)
28 } 28 }
29 if (commandLine.hasOption(HELP)) { 29 if (commandLine.hasOption(HELP)) {
30 HelpFormatter().printHelp("$SHORTNAME create", options) 30 HelpFormatter().printHelp("$SHORTNAME create [options]", options)
31 exitProcess(0) 31 exitProcess(0)
32 } 32 }
33 checkArguments() 33 checkArguments()
34 val db = Database.open() 34 val db = Database.open()
35 35
95 error("--$option requires --$GENERATE") 95 error("--$option requires --$GENERATE")
96 bad = true 96 bad = true
97 } 97 }
98 } 98 }
99 } 99 }
100 if (commandLine.args.isNotEmpty()) {
101 error("unexpected trailing arguments")
102 }
103 if (bad) { 100 if (bad) {
104 exitProcess(2); 101 exitProcess(2);
105 } 102 }
103 if (commandLine.args.isNotEmpty()) {
104 die("unexpected trailing arguments", 2)
105 }
106 } 106 }
107 } 107 }