Replies: 1 comment 1 reply
-
Ciao Nicola, Firstly, I sincerely appreciate your insightful question. Your input could prove beneficial not only for your specific use case but also for other users who encounter similar scenarios. I will now address your points individually:
Indeed, your understanding is accurate. The template
Indeed, if you intend to construct the command hierarchy dynamically at runtime, the "typed" Insert method (which constructs an internal
It's crucial to clarify that the library's autocompletion feature isn't as sophisticated as your expectations suggest. Whether you utilize the
Given that the current library version does not facilitate autocompletion for command arguments, I propose creating your own As a matter of curiosity, how do you envision specifying the callback command within the JSON structure? I would greatly appreciate your thoughts on this proposed solution. I am committed to collaborating with you to arrive at the most effective resolution, given the universal applicability of this concern. In the event we formulate a "generic solution," it could serve as a valuable addition to the library's examples. Looking forward to your input. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Ciao Daniele,
Nice work, congrats. I like both the design and the implementation. Very neat and efficient.
There is just one thing I'd like you to confirm (or confute).
If I am not mistaken, the function that parses the command params is defined at compile time (as a template parameter pack).
I have in mind a possible usage of your library where the menu hierarchy is created at run time based on a some sort of other input, for example a JSON file that describes both the commands and the menu hierarchy. Now the problem that I foresee is that each command has an its own different "signature" (ie. list of parameters) which is only known once the input file is parsed and that does not work with the design you chose (template parameter pack).
I can certainly use the version of the parser callback that takes a vector of strings and do the checks there for each different command, but in that case we lose the capability of autocompletion only for a certain number of params (e.g. if you register as parser a function that takes two params - say a int and a string - and the use inputs both of them and then press tab, the cursor does not move, which is a nice way to let the user know that the required input is over).
Am I mistaken or, because of the design choice that you make, no workaround is possible to register a callback whose signature is known only at run time ?
Do you have any other trick to address my scenario?
Thanks in advance for your answer.
N.
Beta Was this translation helpful? Give feedback.
All reactions