Homec4science

Move command spelling correction to libphutil

Authored by epriestley <git@epriestley.com> on Jul 26 2016, 22:19.

Description

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

Details

Committed
epriestley <git@epriestley.com>Jul 27 2016, 18:35
Pushed
aubortMar 17 2017, 12:03
Parents
rPHUff84abc7d857: If "utf8mb4" is unavailable on the client, fall back to "binary"
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUd0daa2b343e4: Move command spelling correction to libphutil (authored by epriestley <git@epriestley.com>).Jul 27 2016, 18:35