mfgtools icon indicating copy to clipboard operation
mfgtools copied to clipboard

CLI and feedback enhancements

Open stevebroshar opened this issue 8 months ago • 1 comments

This is a big change so you may be hesitant to merge it. None the less and FWIW the tool is very useful, but I found the UX lacking including CLI, help info and user feedback. I reworked these aspects and as it was a significant change and the CLI code lacked structure (lacked componentization, uuu.cpp way too big, ...), I organized the code somewhat.

I started from NXP repo commit da3cd53f056a7868fdffaa631e4e426847aec309 (16-May-2024, Fix PID 0159 device name from imx93 to imx91). Via backmerge, all files auto-merged except for uuu.cpp which had too many changes. To support review of the new CLI without deleting the old one, I renamed my uuu.cpp to cli.h so that uuu.cpp is mostly the same as it was. Can choose which CLI to use in main(). It's a half-measure but I didn't want to just delete the existing CLI code. I did update the old CLI to work with the other changes throughout.

There were about 20 commits after 16-may-2024 up to today (11-mar-2024). Since all files automerged other than uuu.cpp, only commits that modified uuu.cpp require manual merging. These are:

f764c01 fixes #443: -udev stdout should replace 70-uuu.rules rather than be appended to it Resolution: Changes made manually in cli.h 5d77a61 Improve uuu help context Resolution: No chagne required since new CLI code includes new help info 6c2141e Add dynamic MAX_PROGRESS_WIDTH global variable to handle long lines (#435) Resolution: **Skipped since couldn't understand intent of change. FYI This change would go into HorizontalScrollingFormatter.h; not cli.h 09fe178 remove ref global varible g_verbose in bmap.cpp Resolution: Changes made manually in cli.h c031b2a move global g_bmap_mode into libuuu Resolution: Changes made manually in cli.h

CHANGES o Theme: Command based CLI - New CLI that is command-based; instead of switches that control high-level modes - Segregation between install operations and other operations. Most options only apply to install. Makes it clearer what options go with what operations. - install [OPTIONS] auto-detect-file - install [OPTIONS] -s script-file ARGS - install [OPTIONS] PRO: ARGS - ls-devices: replaces -lsusb - ls-builtin [BUILTIN]: moved built-in list out of -h - cat-builtin BUILTIN: replaces -bshow - help CONTEXT: organizes help info more consistently - Renamed -d to --continuous: 'deamon' is too gargony - Renamed -s to -i|--interactive: 'shell' is too gargony - Renamed -m to --filter-path: more readable - Renamed -ms to --filter-serial: more readable - All multi-char options require two dashes: more consistent with other tools o Theme: Enhance overwrite-based feedback - Fixed horizontal scrolling of active command; it was only scrolling one or two chars left - Show final status as "Successful" instead of "Done" since is more useful to know succeeded; not just done o Theme: Enhance append-based feedback - Show waiting for device message after validation so that it's not showing when never actually waiting for a device - NOTIFY_CMD_INFO messages came out without context and % complete partially overwrote it; looked bad - Added color and spacing to enhance readability o Theme: Enhance CLI and script processing UX - Overhauled error handling and reporting for CLI and script processing - Provide limited feedback for bad input instead of outputting pages of info which is off-putting and confusing. Show limited help unless user asks for details. - Edited help content for clarity and organized for uniformity o Theme: Simplify logic and enhance code quality - For overwriting feedback, leave the cursor at the end of the status area instead of trying to move it below the area on exit - Factored out much of uuu.cpp into new files since it was too large and consisting of rather unrelated logic - Renamed types that mentioned built-in scripts to be more generic since they are used for custom scripts as well as built-in script - Add logger class and singleton to centralize logging logic - Removed "using std" to make code easier to move between .cpp and .h files - Changed feedback output to stderr so that commands that output info that one might want to capture does not include the info (unless they also capture stderr). In particular, 'help udev' (old -udev) outputs info that one wants in a file, but they don't want the app title or the instructions which both now go to stderr. - Added header comments for functions that I learned what they did o Theme: Support doxygen - Enable doxygen output by adding @file to source files - Enable doxygen output by adding Doxyfile; didn't understand how the existing Doxyfile.in file works o Theme: Tried to fix auto-complete - Auto-complete disabled for Linux since fails for input like: uuu f.uuu foo - Auto-complete disabled for Windows since crashes for input line: uuu -autocomplete o Theme: devops enhancements - Minor changes to support building outside CI build system

stevebroshar avatar Mar 11 '25 21:03 stevebroshar

Thank you for your patches.

  1. need add Signed-off-by: tag for each commit.
  2. Can you split to some small pull request, we can go through one by one.
  3. Avoid code style change and logic change together.
  4. Remove debug code.

nxpfrankli avatar Mar 11 '25 22:03 nxpfrankli