File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,23 @@ class Frontend {
9797
9898 /// Runs the linter or formatter over the inputs.
9999 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+ )
101117 processStandardInput ( )
102118 } else {
103119 processURLs (
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ struct LintFormatOptions: ParsableArguments {
108108 var experimentalFeatures : [ String ] = [ ]
109109
110110 /// 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. " )
112112 var paths : [ String ] = [ ]
113113
114114 @Flag ( help: . hidden) var debugDisablePrettyPrint : Bool = false
You can’t perform that action at this time.
0 commit comments