Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhelpful -help message #7224

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix unhelpful -help message #7224

wants to merge 1 commit into from

Conversation

AndrewHoos
Copy link
Contributor

Fixes #7218

Fix the unhelpful dialogue when invoking swift package -help

Motivation:

swift package -help is documented as a valid spelling. So it should work

Modifications:

Specifically detect -help in the argument

Result:

swift package -help prints the help message

@MaxDesiatov
Copy link
Member

I feel like we should be able to handle this on ArgumentParser level, thus requesting relevant reviewers

@@ -99,15 +99,14 @@ extension SwiftPackageTool {

func run(_ swiftTool: SwiftTool) throws {
// See if have a possible plugin command.
guard let command = remaining.first else {
guard let command = remaining.first,
!Set(["", "-h", "--help", "-help"]).contains(command) else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no point in making this a Set. The performance is going to be at least O(n) in order to simply construct the set, and it's a temporary value. It can just be an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion See 'package -help' for more information. is probably wrong
3 participants