@@ -2,14 +2,17 @@ package org.cqfn.diktat
2
2
3
3
import org.cqfn.diktat.api.DiktatLogLevel
4
4
import org.cqfn.diktat.api.DiktatReporterType
5
+ import org.cqfn.diktat.common.config.rules.DIKTAT
5
6
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
6
9
import kotlinx.cli.ArgParser
7
10
import kotlinx.cli.ArgType
8
11
import kotlinx.cli.default
9
12
10
13
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(
13
16
type = ArgType .String ,
14
17
fullName = " config" ,
15
18
shortName = " c" ,
@@ -19,40 +22,32 @@ fun main(args: Array<String>) {
19
22
directory is used.
20
23
""" .trimIndent(),
21
24
).default(DIKTAT_ANALYSIS_CONF )
22
- val config: String by configOption
23
-
24
- val formatOption = parser.option(
25
+ val format: Boolean by parser.option(
25
26
type = ArgType .Boolean ,
26
27
fullName = " format" ,
27
28
shortName = " F" ,
28
29
description = " Fix any deviations from the code style."
29
30
).default(false )
30
- val format: Boolean by formatOption
31
-
32
- val reporterOption = parser.option(
31
+ val reporter: DiktatReporterType by parser.option(
33
32
type = ArgType .Choice <DiktatReporterType >(),
34
33
fullName = " reporter" ,
35
34
shortName = " r" ,
36
35
description = " The reporter to use" ,
37
36
).default(DiktatReporterType .PLAIN )
38
- val reporter: DiktatReporterType by reporterOption
39
-
40
- val outputOption = parser.option(
37
+ val output: String? by parser.option(
41
38
type = ArgType .String ,
42
39
fullName = " output" ,
43
40
shortName = " o" ,
44
41
description = " Redirect the reporter output to a file." ,
45
42
)
46
- val output: String? by outputOption
47
-
48
- val logLevelOption = parser.option(
43
+ val logLevel: DiktatLogLevel by parser.option(
49
44
type = ArgType .Choice <DiktatLogLevel >(),
50
45
fullName = " log-level" ,
51
46
shortName = " l" ,
52
- description = " Enable the output of specified level" ,
47
+ description = " Enable the output with specific level" ,
53
48
).default(DiktatLogLevel .INFO )
54
- val logLevel: DiktatLogLevel by logLevelOption
55
49
56
50
parser.parse(args)
57
51
52
+ val diktatRuleSetProvider = DiktatRuleSetProvider (config)
58
53
}
0 commit comments