Skip to content

Commit 887edc5

Browse files
committed
[skip-ci] WIP #3
1 parent e2dd4b2 commit 887edc5

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

diktat/src/main/kotlin/org/cqfn/diktat/DiktatMain.kt

+11-16
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ package org.cqfn.diktat
22

33
import org.cqfn.diktat.api.DiktatLogLevel
44
import org.cqfn.diktat.api.DiktatReporterType
5+
import org.cqfn.diktat.common.config.rules.DIKTAT
56
import org.cqfn.diktat.common.config.rules.DIKTAT_ANALYSIS_CONF
7+
import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID
8+
import org.cqfn.diktat.ruleset.rules.DiktatRuleSetProvider
69
import kotlinx.cli.ArgParser
710
import kotlinx.cli.ArgType
811
import kotlinx.cli.default
912

1013
fun main(args: Array<String>) {
11-
val parser = ArgParser("diktat")
12-
val configOption = parser.option(
14+
val parser = ArgParser(DIKTAT)
15+
val config: String by parser.option(
1316
type = ArgType.String,
1417
fullName = "config",
1518
shortName = "c",
@@ -19,40 +22,32 @@ fun main(args: Array<String>) {
1922
directory is used.
2023
""".trimIndent(),
2124
).default(DIKTAT_ANALYSIS_CONF)
22-
val config: String by configOption
23-
24-
val formatOption = parser.option(
25+
val format: Boolean by parser.option(
2526
type = ArgType.Boolean,
2627
fullName = "format",
2728
shortName = "F",
2829
description = "Fix any deviations from the code style."
2930
).default(false)
30-
val format: Boolean by formatOption
31-
32-
val reporterOption = parser.option(
31+
val reporter: DiktatReporterType by parser.option(
3332
type = ArgType.Choice<DiktatReporterType>(),
3433
fullName = "reporter",
3534
shortName = "r",
3635
description = "The reporter to use",
3736
).default(DiktatReporterType.PLAIN)
38-
val reporter: DiktatReporterType by reporterOption
39-
40-
val outputOption = parser.option(
37+
val output: String? by parser.option(
4138
type = ArgType.String,
4239
fullName = "output",
4340
shortName = "o",
4441
description = "Redirect the reporter output to a file.",
4542
)
46-
val output: String? by outputOption
47-
48-
val logLevelOption = parser.option(
43+
val logLevel: DiktatLogLevel by parser.option(
4944
type = ArgType.Choice<DiktatLogLevel>(),
5045
fullName = "log-level",
5146
shortName = "l",
52-
description = "Enable the output of specified level",
47+
description = "Enable the output with specific level",
5348
).default(DiktatLogLevel.INFO)
54-
val logLevel: DiktatLogLevel by logLevelOption
5549

5650
parser.parse(args)
5751

52+
val diktatRuleSetProvider = DiktatRuleSetProvider(config)
5853
}

0 commit comments

Comments
 (0)