File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,23 @@ class Frontend {
97
97
98
98
/// Runs the linter or formatter over the inputs.
99
99
final func run( ) {
100
- if lintFormatOptions. paths. isEmpty {
100
+ if lintFormatOptions. paths == [ " - " ] {
101
+ processStandardInput ( )
102
+ } else if lintFormatOptions. paths. isEmpty {
103
+ diagnosticsEngine. emitWarning (
104
+ """
105
+ Running swift-format without input paths is deprecated and will be removed in the future.
106
+
107
+ Please update your invocation to do either of the following:
108
+
109
+ - Pass `-` to read from stdin (e.g., `cat MyFile.swift | swift-format -`).
110
+ - Pass one or more paths to Swift source files or directories containing
111
+ Swift source files. When passing directories, make sure to include the
112
+ `--recursive` flag.
113
+
114
+ For more information, use the `--help` option.
115
+ """
116
+ )
101
117
processStandardInput ( )
102
118
} else {
103
119
processURLs (
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ struct LintFormatOptions: ParsableArguments {
108
108
var experimentalFeatures : [ String ] = [ ]
109
109
110
110
/// The list of paths to Swift source files that should be formatted or linted.
111
- @Argument ( help: " Zero or more input filenames. " )
111
+ @Argument ( help: " Zero or more input filenames. Use `-` for stdin. " )
112
112
var paths : [ String ] = [ ]
113
113
114
114
@Flag ( help: . hidden) var debugDisablePrettyPrint : Bool = false
You can’t perform that action at this time.
0 commit comments