Closed dsw7 closed 3 months ago
Help messages are currently defined as very big string literals. For example, see: https://github.com/dsw7/GPTifier/blob/95d4a81da5a4bf67bec425bfe0d37673e806d57e/GPTifier/src/help_messages.cpp#L13-L31
This is okay... but not great. We can do better. React advertises the concept of components and I think we can use a similar approach here, for example, given: https://github.com/dsw7/GPTifier/blob/95d4a81da5a4bf67bec425bfe0d37673e806d57e/GPTifier/src/help_messages.cpp#L17-L19
We can turn this into a description "component" - something like:
std::string get_description(const std::string &description) { std::string block = "\033[1mDESCRIPTION:\033[0m\n"; block += description; ... return block; }
And this is still perfectly efficient because the compiler will (probably) do some sort of RVO (see this very old discussion).
Impetus
Help messages are currently defined as very big string literals. For example, see: https://github.com/dsw7/GPTifier/blob/95d4a81da5a4bf67bec425bfe0d37673e806d57e/GPTifier/src/help_messages.cpp#L13-L31
This is okay... but not great. We can do better. React advertises the concept of components and I think we can use a similar approach here, for example, given: https://github.com/dsw7/GPTifier/blob/95d4a81da5a4bf67bec425bfe0d37673e806d57e/GPTifier/src/help_messages.cpp#L17-L19
We can turn this into a description "component" - something like:
And this is still perfectly efficient because the compiler will (probably) do some sort of RVO (see this very old discussion).