Move command spelling correction to libphutil
Summary:
Ref T7489. Currently, arc has helpful flag/argument spelling correction but libphutil does not.
The implementation in arc is also pretty hard-coded, and exposed as static methods on ArcanistConfiguration. This class isn't closely related to argument parsing, and I would like to remove it anyway (see T10329).
This copies the bulk of the implementation to libphutil and separates it out so it isn't bolted onto some other class.
(arc may still need to do some of this on its own, since it has additional rules like aliases that I don't necessarily expect to generalize, but should be able to share this code.)
Test Plan:
$ ./bin/repository reparce --messages (Assuming "reparce" is the British spelling of "reparse".) (Assuming "--messages" is the British spelling of "message".) Usage Exception: Specify a commit or repository to reparse.
$ ./bin/repository heaw Usage Exception: Invalid command "heaw". Did you mean: help thaw For details on available commands, run `repository help`.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T7489
Differential Revision: https://secure.phabricator.com/D16332