initiative-sh / initiative.sh

A web-based command line for game masters
https://initiative.sh/
GNU General Public License v3.0
44 stars 4 forks source link

Update ContextAwareParse to return CommandMatches #328

Closed MikkelPaulson closed 11 months ago

MikkelPaulson commented 11 months ago

Previously, the return type of ContextAwareParse::parse_input() was (Option<Self>, Vec<Self>) with no real explanation of why. This has now been updated to a properly-documented struct called CommandMatches<T>. It also provides convenience functions for converting and combining multiple sets of matches, consolidating some (admittedly simple) logic that was previously scattered all over the place.

Normally I try to keep commits small and numerous in each branch, but this is one of those rip-the-bandaid changes.

Resolves #325.

MikkelPaulson commented 11 months ago

@alfonsomartinezs FYI - this should make the parser handling that we paired on a bit more intuitive, at the expense of possibly breaking the draft branch.