f3d icon indicating copy to clipboard operation
f3d copied to clipboard

Add documentation API for commands

Open mwestphal opened this issue 1 year ago • 5 comments

Describe the bug The libf3d supporting add/removing/triggering commands. The documentation of the commands is in https://f3d.app for now, this is not ideal.

Lets add an API to add/recover documentation for individual command actions.

This should let us implement auto completion for options too.

mwestphal avatar Nov 16 '24 08:11 mwestphal

It should be related to ability to get argument completion help for console. I could work on it once I finish the current stuff.

exbluesbreaker avatar Mar 26 '25 20:03 exbluesbreaker

My initial thoughts about documentation:

  • I am not 100% understand everything, yet but I see addCommand and addBinding are separated for commands. Maybe command and binding for it should be initialized together for clearance and to avoid bugs when command or bindings for it wasn't added and wasn't added correctly. Maybe there are no 1 to 1 correspondance there, but still probably something can be done in such direction.
  • In general, I think it is a good idea to keep for every command structure, which contains std::function to actually call it, overall text description (std::string) what command does, description of return value (if it has) (std::string), list of std::string pairs - name of argument, meaning of argument/description. Some compile time basic checks could be done at compile time - every command provided with exactly as many arguments docs as it have arguments (maybe something else can be checked)

exbluesbreaker avatar Mar 29 '25 21:03 exbluesbreaker

command and binding for it should be initialized together

I'm not sure to follow. Commands bindings are different concept. Bindings are using commands obviously but they are not at the same level.

think it is a good idea to keep for every command structure ...

Yes, I agree, we need to do something like that :)

Some compile time basic checks could be done at compile time

We cant validate commands at compile time though, as command are provided as strings to be tokenized.

mwestphal avatar Mar 30 '25 07:03 mwestphal

I misunderstood bindings at first.

I thought it was related to std::bind like it was assignment of arguments to command call etc. But is related to hotkeys logic to trigger commands. Then bindings related question is out :)

exbluesbreaker avatar Mar 30 '25 18:03 exbluesbreaker

Made the first attempt https://github.com/f3d-app/f3d/pull/2116

exbluesbreaker avatar Apr 02 '25 17:04 exbluesbreaker