@@ -33,12 +33,12 @@ open class SystemExitException(message: String, val returnCode: Int) : Exception
3333 * Prints a message for the user to either `System.err` or `System.out`, and then exits with the appropriate
3434 * return code.
3535 *
36- * @param progName the name of this program as invoked, or null if not known
36+ * @param programName the name of this program as invoked, or null if not known
3737 * @param columns the number of columns to wrap at, or 0 if not to wrap at all
3838 */
39- fun printAndExit (progName : String? = null, columns : Int = 0): Nothing {
39+ fun printAndExit (programName : String? = null, columns : Int = 0): Nothing {
4040 val writer = OutputStreamWriter (if (returnCode == 0 ) System .out else System .err)
41- printUserMessage(writer, progName , columns)
41+ printUserMessage(writer, programName , columns)
4242 writer.flush()
4343 exitProcess(returnCode)
4444 }
@@ -47,11 +47,11 @@ open class SystemExitException(message: String, val returnCode: Int) : Exception
4747 * Prints a message for the user to the specified `Writer`.
4848 *
4949 * @param writer where to write message for the user
50- * @param progName the name of this program as invoked, or null if not known
50+ * @param programName the name of this program as invoked, or null if not known
5151 * @param columns the number of columns to wrap at, or 0 if not to wrap at all
5252 */
53- open fun printUserMessage (writer : Writer , progName : String? , columns : Int ) {
54- val leader = if (progName == null ) " " else " $progName : "
53+ open fun printUserMessage (writer : Writer , programName : String? , columns : Int ) {
54+ val leader = if (programName == null ) " " else " $programName : "
5555 writer.write(" $leader$message \n " )
5656 }
5757}
@@ -60,16 +60,16 @@ open class SystemExitException(message: String, val returnCode: Int) : Exception
6060 * Calls [SystemExitException.printAndExit] on any `SystemExitException` that
6161 * is caught.
6262 *
63- * @param progName the name of the program, or null if not known
63+ * @param programName the name of the program, or null if not known
6464 * @param columns the number of columns to wrap any caught
6565 * `SystemExitException` to. Specify null for reasonable defaults, or 0 to not
6666 * wrap at all.
6767 * @param body the code that may throw a `SystemExitException`
6868 */
69- fun <R > mainBody (progName : String? = null, columns : Int? = null, body : () -> R ): R {
69+ fun <R > mainBody (programName : String? = null, columns : Int? = null, body : () -> R ): R {
7070 try {
7171 return body()
7272 } catch (e: SystemExitException ) {
73- e.printAndExit(progName , columns ? : System .getenv(" COLUMNS" )?.toInt() ? : 80 )
73+ e.printAndExit(programName , columns ? : System .getenv(" COLUMNS" )?.toInt() ? : 80 )
7474 }
7575}
0 commit comments