[dpdk-dev] next technical board meeting, 2017-04-06

Wiles, Keith keith.wiles at intel.com
Fri Mar 31 16:39:23 CEST 2017


Here is a few advantages to CLI:

A couple big advantages I see are:
  - CLI supports commands, files, aliases, directories.
    - The alias command is just a string using a simple substitution support for other other commands similar to the bash shell like alias commands.
    - Files can be static or dynamic information, can be changed on the fly and saved for later. The file is backed with a simple function callback to allow the developer to update the content or not.
  - Added support for color and cursor movement APIs similar to Pktgen if needed by the developer.
  - It is a work alike replacement for cmdline library. Both cmdline and CLI can be used in the same application if care is taken.
  - Uses a simple fake like directory layout for command and files. Allowing for command hierarchy as path to the command can allow for specific targets to be identified without having to state it on the command line. 
  - Has auto-complete for commands, similar to Unix/Linux autocomplete and provides support for command option help as well.
  - Callback functions for commands are simply just argc/argv like functions. The CLI does not convert arguments for the user, it is up to the developer to decode the argv[] values.
    - Most of the arguments converted in the current cmdline are difficult to use or not required as the developer just picks string type and does the conversion himself.
  - Dynamically be able to add and remove commands, directories, files and aliases, does not need to be statically compiled into the application.
  - No weird structures in the code and reduces the line count for testpmd from 11K to 4K lines. I convert testpmd to have both CMDLINE and CLI with a command line option.
  - Two methods to parse command lines, first is the standard argc/argv method in the function. The second method is to use a map of strings with simple printf like formatting to detect which command line the user typed. An ID value it returned to the used to indicate which mapping string was found to make the command line to be used in a switch statement.
  - Central help support if needed (optional).


Regards,
Keith



More information about the dev mailing list