Skip to content

Commit

Permalink
Small code style fixes #3456
Browse files Browse the repository at this point in the history
  • Loading branch information
Nereboss committed May 6, 2024
1 parent 5519780 commit 6282905
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ParserDialog {
return res
}

fun Session.myCollectParserArgs(
internal fun Session.myCollectParserArgs(
fileCallback: suspend RunScope.() -> Unit = {},
actionCallback: suspend RunScope.() -> Unit = {},
printCallback: suspend RunScope.() -> Unit = {},
Expand All @@ -31,19 +31,16 @@ class ParserDialog {
outFileCallback: suspend RunScope.() -> Unit = {}

): List<String> {
var inputFileName: String
var result: List<String> = listOf()
val result: List<String>

inputFileName = myPromptInput(
val inputFileName: String = myPromptInput(
message = "What is the cc.json file that should be modified?",
hint = Paths.get("").toAbsolutePath().toString() + File.separator + "yourInput.cc.json",
invalidInputMessage = "Please input a valid cc.json file!",
inputValidator = InputValidator.isInputAnExistingFile("cc.json", "cc.json.gz"),
onInputReady = fileCallback
)

// return listOf(inputFileName)

val selectedAction: String = myPromptList(
message = "Which action do you want to perform?",
choices = listOf(
Expand All @@ -55,10 +52,6 @@ class ParserDialog {
onInputReady = actionCallback
)

// return listOf(selectedAction)

//TODO: refactor next part to be more readable and do less array/list things

result = when (selectedAction) {
StructureModifierAction.PRINT_STRUCTURE.descripton -> listOf(inputFileName, *collectPrintArguments(printCallback))
StructureModifierAction.SET_ROOT.descripton -> listOf(inputFileName, *collectSetRootArguments(setRootCallback, outFileCallback))
Expand All @@ -71,7 +64,7 @@ class ParserDialog {
}
}

private fun Session.collectPrintArguments(printCallback: suspend RunScope.() -> Unit): Array<String> { //diese funktionen als extension vom section scope setzen? können wir sie dann noch private lassen?
private fun Session.collectPrintArguments(printCallback: suspend RunScope.() -> Unit): Array<String> {
val printLevels: String = myPromptInputNumber(
message = "How many print levels do you want to print?", hint = "0",
onInputReady = printCallback)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.maibornwolff.codecharta.tools.inquirer

import com.varabyte.kotter.foundation.input.Keys
import com.varabyte.kotter.foundation.session
import com.varabyte.kotter.foundation.text.black
import com.varabyte.kotter.foundation.text.bold
import com.varabyte.kotter.foundation.text.cyan
Expand Down

0 comments on commit 6282905

Please sign in to comment.