@@ -16,11 +16,18 @@ final class FormatServiceImpl: FormatService {
16
16
private let printService : PrintService
17
17
private let localFileService : LocalFileService
18
18
private let configurationController : ConfigurationController
19
+ private let verboseController : VerboseController
19
20
20
- init ( printService: PrintService , localFileService: LocalFileService , configurationController: ConfigurationController ) {
21
+ init (
22
+ printService: PrintService ,
23
+ localFileService: LocalFileService ,
24
+ configurationController: ConfigurationController ,
25
+ verboseController: VerboseController
26
+ ) {
21
27
self . printService = printService
22
28
self . localFileService = localFileService
23
29
self . configurationController = configurationController
30
+ self . verboseController = verboseController
24
31
}
25
32
26
33
func format( path: String ) throws {
@@ -29,12 +36,13 @@ final class FormatServiceImpl: FormatService {
29
36
case . error, . warning:
30
37
self ? . printService. printText ( " \( type) : \( text) " )
31
38
case . info, . success, . content, . raw:
32
- break
39
+ self ? . printService . printVerbose ( " \( type ) : \( text ) " )
33
40
}
34
41
}
35
42
let currentPath = localFileService. getCurrentPath ( )
36
43
let configurationFilePath = configurationController. getSwiftFormatConfigurationFilePath ( )
37
- let result = CLI . run ( in: currentPath, with: " \( path) --config \( configurationFilePath) --swiftversion 5 " )
44
+ let verboseText = verboseController. isVerbose ( ) ? " --verbose " : " "
45
+ let result = CLI . run ( in: currentPath, with: " \( path) --config \( configurationFilePath) \( verboseText) " )
38
46
39
47
if result != . ok {
40
48
throw ToolsError ( description: " Formatting failed with exit code: \( result) " )
0 commit comments