File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,22 @@ 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 specify one of the following:
108+
109+ - Use - to read from stdin (e.g., cat MyFile.swift | swift-format -)
110+ - Provide a directory path (e.g., swift format --recursive MyDirectory/)
111+ - Provide a specific Swift source file (e.g., swift format MyFile.swift)
112+
113+ For more information, use the --help option.
114+ """
115+ )
101116 processStandardInput ( )
102117 } else {
103118 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. If no paths are provided, stdin input will be used (use `-`). " )
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