Skip to content

Commit 6dcc946

Browse files
authored
Merge pull request swiftlang#25312 from kelhutch17/sr-20
SR-20 Update swift --help to explain multitool support ("swift build"…, etc.)
2 parents 165fc40 + 78802be commit 6dcc946

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/Driver/Driver.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3059,6 +3059,20 @@ void Driver::printHelp(bool ShowHidden) const {
30593059
getOpts().PrintHelp(llvm::outs(), Name.c_str(), "Swift compiler",
30603060
IncludedFlagsBitmask, ExcludedFlagsBitmask,
30613061
/*ShowAllAliases*/false);
3062+
3063+
// These strings match the descriptions found in the corresponding swiftpm
3064+
// help pages
3065+
if (driverKind == DriverKind::Interactive) {
3066+
llvm::outs() << "\nSEE ALSO - PACKAGE MANAGER COMMANDS: \n"
3067+
"\t\"swift build\" Build sources into binary products \n"
3068+
"\t\"swift package\" Perform operations on Swift packages \n"
3069+
"\t\"swift run\" Build and run an executable product \n"
3070+
"\t\"swift test\" Build and run tests \n";
3071+
} else {
3072+
llvm::outs() << "\nSEE ALSO: swift build, swift run, swift package, "
3073+
"swift test \n";
3074+
}
3075+
30623076
}
30633077

30643078
bool OutputInfo::mightHaveExplicitPrimaryInputs(

test/Driver/help.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@
2121

2222
// Options marked "help-hidden" should not show up here.
2323
// NEGATIVE-NOT: -parse-stdlib
24+
25+
// CHECK-SWIFTC: SEE ALSO: swift build, swift run, swift package, swift test
26+
// NEGATIVE-SWIFTC-NOT: SEE ALSO - PACKAGE MANAGER COMMANDS:
27+
// CHECK-SWIFT: SEE ALSO - PACKAGE MANAGER COMMANDS:
28+
// NEGATIVE-SWIFT-NOT: SEE ALSO: swift build, swift run, swift package, swift test

0 commit comments

Comments
 (0)