Avoid unnecessary temporary variable in short-hand translation

This commit is contained in:
Jonas Tobias Hopusch 2021-09-19 20:23:26 +02:00
parent a48f122296
commit 4ab78f4028
Failed to generate hash of commit

View file

@ -23,9 +23,8 @@ fun main(args: Array<String>) {
options.add(arg.substring(startIndex=2))
}
else if (arg.startsWith('-')) {
val translation = optionDictionary[arg]
if (translation != null)
options.add(translation.substring(startIndex=2))
if (optionDictionary.containsKey(arg))
options.add(optionDictionary[arg]!!.substring(startIndex=2))
else
System.err.println("Short-hand '$arg' does not exist. Ignoring!")
}