Uploaded image for project: 'Swift'
  1. Swift
  2. SR-10794

Have SwiftPM suggest close commands

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Package Manager
    • Labels:
      None

      Description

      When SwiftPM is run with an invalid command, it could be caused by a typo or because the user does not remember the precise command. By having SwiftPM detect those cases and suggest the correct command, SwiftPM would be more friendly to use.

      This feature could be implemented by modifying ArgumentParser to use the new Ordered Collection Diffing API in Swift 5.1 to compare the invalid command to the available commands and suggest on close matches.

      Here's an example what it could look like:

      $ swift build --packagepath ../path
      error: unknown option --packagepath; use --help to list available options
      Did you mean --package-path?

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            hartbit David Hart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: