rbxmk icon indicating copy to clipboard operation
rbxmk copied to clipboard

Deferred command descriptions

Open Anaminus opened this issue 2 years ago • 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.

Anaminus avatar Jul 22 '22 18:07 Anaminus