exa/src/options
Benjamin Sago ed59428cbc Replace Misfire with a testable OptionsResult
This was meant to be a small change, but it spiralled into a big one.

The original intention was to separate OptionsResult and OptionsError. With these types separated, the Help and Version variants can only be returned from the Options::parse function, and the later option-parsing functions can only return success or errors.

Also, Misfire was a silly name.

As a side-effect of Options::parse returning OptionsResult instead of Result<Options, Misfire>, we could no longer use unwrap() or unwrap_err() to get the contents out. This commit makes OptionsResult into a value type, and Options::parse a pure function. It feels like it should be one, having its return value entirely dependent on its arguments, but it also loaded locales and time zones. These parts have been moved into lazy_static references, and the code still passes tests without much change.

OptionsResult isn't PartialEq yet, because the file colouring uses a Box internally.
2020-10-12 23:47:36 +01:00
..
dir_action.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
error.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
filter.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
flags.rs Batch source formatting 2020-10-10 20:02:55 +01:00
help.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
mod.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
parser.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
style.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
vars.rs Batch source formatting 2020-10-10 20:02:55 +01:00
version.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00
view.rs Replace Misfire with a testable OptionsResult 2020-10-12 23:47:36 +01:00