-
Notifications
You must be signed in to change notification settings - Fork 30
/
ParserDialog.kt
55 lines (46 loc) · 2.29 KB
/
ParserDialog.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package de.maibornwolff.codecharta.importer.gitlogparser
import com.github.kinquirer.KInquirer
import com.github.kinquirer.components.promptConfirm
import com.github.kinquirer.components.promptInput
import de.maibornwolff.codecharta.tools.interactiveparser.ParserDialogInterface
class ParserDialog {
companion object : ParserDialogInterface {
private const val EXTENSION = "log"
override fun collectParserArgs(): List<String> {
print("You can generate this file with: git log --numstat --raw --topo-order --reverse -m > git.log")
val defaultInputFileName = "git.$EXTENSION"
val inputFileName = KInquirer.promptInput(
message = "What is the $EXTENSION file that has to be parsed?",
hint = defaultInputFileName,
default = defaultInputFileName
)
val defaultOutputFileName = getOutputFileName(inputFileName)
val outputFileName: String = KInquirer.promptInput(
message = "What is the name of the output file?",
hint = defaultOutputFileName,
default = defaultOutputFileName
)
print("You can generate this file with: git ls-files > file-name-list.txt")
val defaultFileNameList = "file-name-list.txt"
val fileNameList = KInquirer.promptInput(
message = "What is the path to the file name list?",
hint = defaultFileNameList,
default = defaultFileNameList
)
val isCompressed: Boolean =
KInquirer.promptConfirm(message = "Do you want to compress the output file?", default = true)
val isSilent: Boolean =
KInquirer.promptConfirm(message = "Do you want to suppress command line output?", default = false)
val addAuthor: Boolean =
KInquirer.promptConfirm(message = "Do you want to add authors to every file?", default = false)
return listOfNotNull(
inputFileName,
"--output-file=$outputFileName",
"--file-name-list=$fileNameList",
if (isCompressed) null else "--not-compressed",
"--silent=$isSilent",
"--add-author=$addAuthor"
)
}
}
}