Commit Graph
2 Commits
Author SHA1 Message Date
Niccolò Fontana 2092075249 Add a precondition to prevent the parsing of a command that has itself as its subcommand (#197)
* Add a precondition to prevent the parsing of a command that has itself as its subcommand.

This avoids the infinite recursion that causes a crash and shows the user a meaningful error message.

Fixes: https://github.com/apple/swift-argument-parser/issues/192

* Fix the detection of a command that has itself as its subcommand

- The recursion detection now works for both the root command and its subcommands
- Add a test to shows that the fix works

* Fix typo in TreeTests
2020-06-29 14:53:49 -05:00
Nate Cook f6ac7b8118 Initial import of ArgumentParser 2020-02-27 15:45:22 -06:00