File tree 2 files changed +21
-2
lines changed
Sources/swift-format/Subcommands
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,15 @@ extension SwiftFormatCommand {
36
36
var performanceMeasurementOptions : PerformanceMeasurementsOptions
37
37
38
38
func validate( ) throws {
39
- if inPlace && formatOptions. paths. isEmpty {
40
- throw ValidationError ( " '--in-place' is only valid when formatting files " )
39
+ if formatOptions. paths. isEmpty, formatOptions. assumeFilename == nil {
40
+ throw ValidationError (
41
+ """
42
+ No input files specified. Use one of the following:
43
+ - Provide the path to a directory along with the '--recursive' option to format all Swift files within it.
44
+ - Provide the path to a specific Swift source code file.
45
+ Additionally, if you want to overwrite files in-place, use '--in-place'.
46
+ """
47
+ )
41
48
}
42
49
}
43
50
Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ extension SwiftFormatCommand {
32
32
@OptionGroup ( visibility: . hidden)
33
33
var performanceMeasurementOptions : PerformanceMeasurementsOptions
34
34
35
+ func validate( ) throws {
36
+ if lintOptions. paths. isEmpty, lintOptions. assumeFilename == nil {
37
+ throw ValidationError (
38
+ """
39
+ No input files specified. Use one of the following:
40
+ - Provide the path to a directory along with the '--recursive' option to lint all Swift files within it.
41
+ - Provide the path to a specific Swift source code file.
42
+ """
43
+ )
44
+ }
45
+ }
46
+
35
47
func run( ) throws {
36
48
try performanceMeasurementOptions. printingInstructionCountIfRequested {
37
49
let frontend = LintFrontend ( lintFormatOptions: lintOptions)
You can’t perform that action at this time.
0 commit comments