Skip to content

Commit 9108461

Browse files
committed
Rename progName to programName
1 parent 004f254 commit 9108461

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/main/kotlin/com/xenomachina/argparser/DefaultHelpFormatter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DefaultHelpFormatter(
6666
val indentWidth = indent.codePointWidth()
6767

6868
override fun format(
69-
progName: String?,
69+
programName: String?,
7070
columns: Int,
7171
values: List<HelpFormatter.Value>
7272
): String {
@@ -76,7 +76,7 @@ class DefaultHelpFormatter(
7676
else -> columns
7777
}
7878
val sb = StringBuilder()
79-
appendUsage(sb, effectiveColumns, progName, values)
79+
appendUsage(sb, effectiveColumns, programName, values)
8080
sb.append("\n")
8181

8282
if (!prologue.isNullOrEmpty()) {
@@ -143,8 +143,8 @@ class DefaultHelpFormatter(
143143
private fun usageText(value: HelpFormatter.Value) =
144144
value.usages.map { it.replace(' ', '\u00a0') }.joinToString(", ")
145145

146-
private fun appendUsage(sb: StringBuilder, columns: Int, progName: String?, values: List<HelpFormatter.Value>) {
147-
var usageStart = USAGE_PREFIX + (if (progName != null) " $progName" else "")
146+
private fun appendUsage(sb: StringBuilder, columns: Int, programName: String?, values: List<HelpFormatter.Value>) {
147+
var usageStart = USAGE_PREFIX + (if (programName != null) " $programName" else "")
148148

149149
val valueSB = StringBuilder()
150150
for (value in values) value.run {

src/main/kotlin/com/xenomachina/argparser/Exceptions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class ShowHelpException internal constructor(
2828
private val helpFormatter: HelpFormatter,
2929
private val delegates: List<ArgParser.Delegate<*>>
3030
) : SystemExitException("Help was requested", 0) {
31-
override fun printUserMessage(writer: Writer, progName: String?, columns: Int) {
32-
writer.write(helpFormatter.format(progName, columns, delegates.map { it.toHelpFormatterValue() }))
31+
override fun printUserMessage(writer: Writer, programName: String?, columns: Int) {
32+
writer.write(helpFormatter.format(programName, columns, delegates.map { it.toHelpFormatterValue() }))
3333
}
3434
}
3535

src/main/kotlin/com/xenomachina/argparser/HelpFormatter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ interface HelpFormatter {
2525
/**
2626
* Formats a help message.
2727
*
28-
* @param progName name of the program as it should appear in usage information, or null if
28+
* @param programName name of the program as it should appear in usage information, or null if
2929
* program name is unknown.
3030
* @param columns width of display help should be formatted for, measured in character cells, or 0 for infinite
3131
* width.
3232
* @param values [Value] objects describing the arguments types available.
3333
*/
34-
fun format(progName: String?, columns: Int, values: List<Value>): String
34+
fun format(programName: String?, columns: Int, values: List<Value>): String
3535

3636
/**
3737
* An option or positional argument type which should be formatted for help

src/main/kotlin/com/xenomachina/argparser/SystemExitException.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)