Anaminus/rbxmk

Deferred command descriptions

Opened this issue · 0 comments

Cobra, as well as most flag packages, requires specifying the description of a command as a string. Because rbxmk descriptions are dynamic, this means that a lot of work is put into initializing descriptions even if they aren't used.

rbxmk's fork of Cobra should be fitted with an option to defer its descriptions. This can be implemented as the following: When getting the description of a command, if the description field is empty, check the description resolver field, which is a function that returns a string. If specified, call it, and set the description field to the result.