changeset 1:5ea54efa8e45

Commit un-checked-in stuff.
author David Barts <n5jrn@me.com>
date Tue, 14 Apr 2020 11:46:23 -0700
parents 895aa9a8d628
children 2abd1acde716
files src/name/blackcap/osdep/Osdep.kt
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/osdep/Osdep.kt	Sat Feb 08 08:46:17 2020 -0800
+++ b/src/name/blackcap/osdep/Osdep.kt	Tue Apr 14 11:46:23 2020 -0700
@@ -47,12 +47,12 @@
         addOption("c", "clean", false, "Clean instead of copying.")
         addOption("t", "type", true, "Specify OS type (default ${ostype}).")
     }
-    var cmdLine: CommandLine? = null
-    try {
-        cmdLine = DefaultParser().parse(options, args)
+    val cmdLine: CommandLine? = try {
+        DefaultParser().parse(options, args)
     } catch (e: ParseException) {
         System.err.format("%s: %s%n", MYNAME, e.message)
         System.exit(2)
+        null
     }
 
     if (cmdLine!!.hasOption("help")) {
@@ -61,7 +61,7 @@
         System.exit(0);
     }
 
-    val clOstype = cmdLine!!.getOptionValue("type")
+    val clOstype = cmdLine.getOptionValue("type")
     if (clOstype != null) {
         ostype = clOstype
     }
@@ -74,7 +74,7 @@
         }
     }
 
-    val process = if (cmdLine!!.hasOption("clean")) ::clean else ::copy
+    val process = if (cmdLine.hasOption("clean")) ::clean else ::copy
     files.forEach {
         process(it.key, it.value)
     }
@@ -99,7 +99,6 @@
     }
     val base = path.substring(0 .. (dot1 - 1))
     val type = path.substring((dot1 + 1) .. (dot2 - 1))
-    println("base=${base}, type=${type}") /* debug */
     val fset = files[base]
     if (fset != null) {
         fset.add(type)