3 ms·
For comparison, FRRouting has 25 year old CLI code: https://github.com/FRRouting/frr/blob/master/doc/developer/cli.rst https://github.com/FRRouting/frr/blob/ma
by eqvinox 6y ago
For comparison, FRRouting has 25 year old CLI code:
https://github.com/FRRouting/frr/blob/master/doc/developer/cli.rst https://github.com/FRRouting/frr/blob/master/doc/developer/c...
https://github.com/FRRouting/frr/blob/master/lib/command.c https://github.com/FRRouting/frr/blob/master/lib/command.c
(+ other files nearby)
looks like this:
DEFUN (show_version,
show_version_cmd,
"show version",
SHOW_STR
"Displays zebra version\n")
{ ... }
install_element(VIEW_NODE, &show_version_cmd);
self-registering commands (__attribute__((constructor))) are on the TODO list.
On the other hand we have automatic parameter parsing into proper C types (look for "DEFPY" in the code/docs.)
disclaimer: I conceived and implemented DEFPY.